StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Event

Stimulsoft Reports.NET discussion
petrdivis
Posts: 19
Joined: Thu Mar 23, 2017 7:05 am

StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Event

Post 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
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Post by Alex K. »

Hello,

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

Thank you.
petrdivis
Posts: 19
Joined: Thu Mar 23, 2017 7:05 am

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Post by petrdivis »

Hello,

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

Thanks
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Post 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.
petrdivis
Posts: 19
Joined: Thu Mar 23, 2017 7:05 am

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Post 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.
petrdivis
Posts: 19
Joined: Thu Mar 23, 2017 7:05 am

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Post by petrdivis »

I have also added GIF with issue reproduction recording first opening via recent file, then over Browse.
Image
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Post by Alex K. »

Hello,

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

Thank you.
petrdivis
Posts: 19
Joined: Thu Mar 23, 2017 7:05 am

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Post by petrdivis »

Hello, so how far did you get? any news?

thanks

Petr
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Post by HighAley »

Hello, Petr.

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

Thank you.
petrdivis
Posts: 19
Joined: Thu Mar 23, 2017 7:05 am

Re: StiDesigner.LoadedReport vs. OpenRecentFileInDesigner Ev

Post 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
Post Reply