Page 1 of 2

StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Event

Posted: Mon May 01, 2017 7:07 pm
by petrdivis
Hi,

We need to make our reports backwards compatible after we removed our CustomReportDatabase from StiOptions.Services.Databases and use only StiOptions.Services.DataAdapters.

When loading the old mrt file into Designer with these event handlers, LoadedReport loads the invalid database connection before conversion, but OpenRecentFileInDesigner with Processed=false reloads the datasources correctly without the database. Then the report can be previewed as well.

Code: Select all

StiDesigner.LoadedReport += LoadedReport;
StiOptions.Engine.GlobalEvents.OpenRecentFileInDesigner += LoadedReportFromRecent;

public void LoadedReport(object sender, EventArgs e)
{
    var stiDesignerControl = sender as StiDesignerControl;    
    var file = ReportConverterTool.Convert(stiDesignerControl.ReportFileName);
    StiReport.Load(file);
}
private void LoadedReportFromRecent(object sender, StiOpenRecentFileObjectEventArgs e)
{
    var file = ReportConverterTool.Convert(e.FileName);
    e.Processed = false;    
    StiReport.Load(file);
}
So is there a way how to notify the event LoadedReport to behave as with processed=false too?

Thanks

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Posted: Wed May 03, 2017 9:56 pm
by Alex K.
Hello,

Please send us a simple project which reproduces the issue for analysis.

Thank you.

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Posted: Thu May 04, 2017 1:33 pm
by petrdivis
Hello,

I created a simple project that reproduces it here https://github.com/czechdude/Stimulsoft ... nerExample

Thanks

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Posted: Mon May 08, 2017 9:17 am
by Alex K.
Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?
How to reproduce the issue on your project?

Thank you.

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Posted: Mon May 08, 2017 10:43 am
by petrdivis
Hi,
we switched to Stimulsoft 2016_3 from 2013_3. We had CustomDatabase and CustomDatasource for our reports, but we found CustomDatabase to be useless and we deleted the implementation. But our customers have mrt files that contain the definition of our CustomDatabase.

So we want to convert their mrt on-the-fly when they open the report in Stimulsoft Report Designer. We try to achieve this by writing event handlers on file open.

the Report.mrt contains:

Code: Select all

<Databases isList="true" count="1">
      <Custom Ref="2" type="ReportDesignerExample.GReportDatabase" isKey="true">
        <Alias>Connection</Alias>
        <ConnectionStringEncrypted />
        <Name>Custom</Name>
      </Custom>
    </Databases>
which we delete in the event handler LoadedReport by calling GReportConverterTool.Convert and save to the original Report.mrt file. Then the report is loaded, but the database in the right Dictionary is still shown.

Image

When you revert the Report.mrt to contain the database again and open the report via Recent files, the conversion and loading is done correctly and the dictionary does not contain the database anymore and can be Previewed.

Image

I wanted to point out the different behaviour of StiDesigner.LoadedReport and StiOptions.Engine.GlobalEvents.OpenRecentFileInDesigner.

The behaviour of StiOptions.Engine.GlobalEvents.OpenRecentFileInDesigner is correct and loads the report after conversion correctly without the Database, but StiDesigner.LoadedReport does not work correctly and does not reload the report when converted.

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Posted: Mon May 08, 2017 3:10 pm
by petrdivis
I have also added GIF with issue reproduction recording first opening via recent file, then over Browse.
Image

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Posted: Thu May 11, 2017 9:49 am
by Alex K.
Hello,

Sorry for the delay with response.
We need some additional time to check the issue.

Thank you.

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Posted: Tue May 30, 2017 6:23 am
by petrdivis
Hello, so how far did you get? any news?

thanks

Petr

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Posted: Fri Jun 02, 2017 7:48 am
by HighAley
Hello, Petr.

Sorry for the delay with answer.
Please, try to use the LoadingReport event instead of the LoadedReport event.

Thank you.

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Posted: Fri Jun 09, 2017 7:06 am
by petrdivis
Hi HighAley,

when using LoadingReport, the report filename is not there as the event appears before the Browse dialog opens.
I am reading StiDesignerControl.ReportFileName property.

Cheers
Petr