Angular JS Viewer - Render report after editing the datasource

Posted by: char.efthimiou on 10 January 2022, 1:10 am EST

  • Posted 10 January 2022, 1:10 am EST

    Hello.
    I have found this piece of code :
     using (var reportStream GetType().Assembly.GetManifestResourceStream("RuntimeDataBinding.CallCenterPerformace.rdlx"))
    using (var reader = new System.IO.StreamReader(reportStream))
    {
    var rpt = new GrapeCity.ActiveReports.PageReport(reader);
    var pdfRe = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
    var output = new GrapeCity.ActiveReports.Rendering.IO.MemoryStreamProvider();
    rpt.Document.LocateDataSource += (sender, args) =>
    {
    args.Data = dataLayer.GetPerformanceData(startDate, endDate);
    };
    rpt.Document.Render(pdfRe, output);
    return output.GetPrimaryStream().OpenStream();


    Based on that my question would be : What would I need to return(Instead of a PDF rendered stream) to my Angular UI in order to render it with my JSViewer?

    Thank you in advance.
    Ch.E
  • Marked as Answer

    Replied 10 January 2022, 6:02 pm EST

    Hello,

    The JSViewer can render a report not a PDF stream. It uses an ASP.NET Middleware to service the requests and load reports. Please see the following documentation page for more details on this -
    https://www.grapecity.com/activereportsnet/docs/v15/online/jsvieweraspnet-middleware.html

    Now, coming to your requirement of loading runtime data in the report, you need to use the settings.SetLocateDataSource() method instead of the LocateDataSource event.

    app.UseReporting(settings =>
    {
    settings.UseEmbeddedTemplates(EmbeddedReportsPrefix, Assembly.GetAssembly(GetType()));
    settings.SetLocateDataSource(args =>
    {
    return dataLayer.GetPerformanceData(startDate, endDate);
    });
    settings.UseCompression = true;
    });


    You may refer the following forum post which addresses a similar requirement:
    https://www.grapecity.com/forums/activereports/help-for-usecustomstore-rd

    You may also refer the code samples for the JSViewer available on github, for detailed implementation:
    https://github.com/activereports/WebSamples15/tree/main/JsViewerSamples
  • Replied 12 January 2022, 3:00 am EST

    Thank you I managed to get it to work.
Need extra support?

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

Learn More

Forum Channels