Drill-Through Reports as Embedded Resource

Posted by: mdynna on 26 March 2020, 6:05 am EST

    • Post Options:
    • Link

    Posted 26 March 2020, 6:05 am EST

    I’ve been experimenting with Drill-Through Page reports. It seems they do not work when the reports as set as Embedded Resources within the assembly. Clicking on a control in the report that activates the secondary report produces the following exception:

    Exception details:

    System.Exception: Report to execute not found or failed: PageReportDetail —> System.NullReferenceException: Object reference not set to an instance of an object.

    at GrapeCity.ActiveReports.Viewer.Win.Rdlx.RdlxDocumentModel.<>c__DisplayClass3.#rNZ(String ext)

    at System.Linq.Enumerable.WhereSelectArrayIterator

    2.MoveNext()    at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable
    1 source, Func`2 predicate)

    at GrapeCity.ActiveReports.Viewer.Win.Rdlx.RdlxDocumentModel.#cxz(String reportName, ResourceLocator resourceLocator)

    at GrapeCity.ActiveReports.Viewer.Win.Rdlx.RdlxDocumentModel.#BM0(IDrillthrough drillthrough, IErrorHandler errorHandler)

    — End of inner exception stack trace —

  • Posted 26 March 2020, 4:51 pm EST

    Hello,

    You can try after placing both reports in the same folder.

    Please refer the following link to achieve the drill-through feature:

    https://help.grapecity.com/activereports/webhelp/AR13/webframe.html#SetADrill-ThroughLink.html

    Also, please refer to the attached report to implement the same.

    Thanks,

    Mohit

    MainReport.zip

  • Posted 27 March 2020, 3:58 am EST

    Yes, I’ve gotten it to work when the report files are “deployed” as files on the disk and loaded like this:

    Dim fi As New System.IO.FileInfo(FilePath & “AR_Reports\Reports\PageReportTest.rdlx”)

    Dim repDef As New GrapeCity.ActiveReports.PageReport(fi)

    Dim runt As New GrapeCity.ActiveReports.Document.PageDocument(repDef)

    What I would like to do, is have the report files as Embedded Resources in the DLL, and loaded like this:

    Dim ReportStream As System.IO.Stream = System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream(“Reports.PageReportTest.rdlx”)

    Dim tr As New System.IO.StreamReader(ReportStream)

    Dim repDef As New GrapeCity.ActiveReports.PageReport(tr)

    Dim runt As New GrapeCity.ActiveReports.Document.PageDocument(repDef)

    The above code works to display the primary report, but as soon as I click the control to display the drill-down report then I get an exception. Is there an event that I can catch to redirect it to load the embedded resource?

  • Posted 29 March 2020, 4:30 pm EST

    Hello,

    You can use the custom resource locator to achieve your requirements. Please refer to the following link:

    https://help.grapecity.com/activereports/webhelp/AR13/webframe.html#AdvancedCustomResourceLocator.html

    Thanks,

    Mohit

  • Posted 6 July 2023, 4:16 am EST

    That link works for getting an embedded image using a custom ResourceLocator, but is there an example of how to drill through into an embedded report using a custom ResourceLocator?

  • Posted 6 July 2023, 10:18 pm EST

    Hi John,

    You can implement the ‘ResourceLocator’ to override the ‘GetResource()’ method, this method will get called when your report is looking for the ‘Drill-through’ report (i.e. when the item has been clicked to navigate to the drill-through report). You can then load your report into a ‘GrapeCity.ActiveReports.Resource’ object and return it through the same method.

    Please find attached a sample implementing the same.

    Regards,

    Anand

    ReportResourceLocator.zip

  • Posted 7 July 2023, 2:58 am EST - Updated 7 July 2023, 7:14 am EST

    Hi Anand,

    Your solution works great, thanks, I see it uses version 17.1.2

    I have tried an identical solution using 17.0.2 but the GetResource method is not called and it fails with a file not found exception. Should I upgrade to 17.1.2 to fix this?

    John

  • Posted 9 July 2023, 9:31 pm EST

    Hi John,

    We could observe the issue ‘File not found’ with ActiveReports v17.0.2, upgrading the project to ActiveReports v17.1.2 fixes the issue on our end.

    So, yes you should try updating your project to ActiveReports v17.1.2 to see if the issue persists.

    If the issue persists please try sharing a stripped-down sample replicating the issue so we could test the behavior on our end and further investigate the issue.

    Regards,

    Anand

  • Posted 10 July 2023, 6:35 am EST

    Hi Anand,

    The issue is fixed when I test in v17.1.2.

    One other question, is there any way to set the data source’s connection string at runtime on the report you are drilling through to? It looks like the ResourceLocator can only load a file stream of the .rdlx file, so any connection string info must be hardcoded within the .rdlx file?

    John

  • Posted 10 July 2023, 10:45 pm EST

    Hi John,

    Before the report is loaded into a Stream we are loading it into a ‘PageReport’ object. You can update the connection details at runtime using the ‘PageReport.Report.DataSources[index].ConnectionProperties’ property.

    We have updated our sample to assign our DataSource for the drill-through report at runtime, you may refer to the same.

    Regards,

    Anand

    ReportResourceLocatorUpdated.zip

  • Posted 11 July 2023, 2:38 am EST

    Thanks Anand, that works great.

    Another question: Is it possible to load the data in the Rdl2.rdlx report we are drilling through to in unbound mode, as described here?

    https://www.grapecity.com/activereportsnet/docs/latest/online/bind-unbound-data-to-page-rdl-at-runtime.html

  • Posted 12 July 2023, 12:36 pm EST

    Hi John,

    We tried using an unbound data source for the drill-down report (Rdl2) by handling the LocateDataSource event for the parent report. However, it does not seem to call the event when locating the DataSource for the child report.

    We have escalated this issue to our development team to get their insights on the same (Case ID: AR-31214) and will get back to you as soon as we have a response back from them.

    Regards,

    Anand

  • Posted 13 July 2023, 1:09 am EST

    Thanks Anand,

    John

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels