Runtime Parameter access

Posted by: jlindemann on 10 February 2023, 8:44 am EST

  • Posted 10 February 2023, 8:44 am EST

    I’m trying out the reporting tool and one thin we’d like to do is let the user save the state of a report. Basically, if they change up some params be able to read that and save it off so they can jump right back to it.

    I’m not seeing a way to read the values of the report parameters at run time. Any help you could provide would be great.

  • Posted 12 February 2023, 8:39 pm EST

    Hello,

    If you use the report viewer component to display a report, then you can register the reportLoaded event handler that has the argument that provides the information about parameter values, for example:

    var viewer = new ActiveReports.Viewer(“#viewer-host”, { language: “en” });

    viewer.reportLoaded.register((args) => {

    console.log(args.report.parameters);

    });

  • Posted 13 February 2023, 1:41 am EST

    Thanks for the reply but I’ve subscribed to that event in angular

            this.reportviewer.reportLoaded.subscribe(load => {
              alert(load.report.parameters.StartDate);
    
            });

    this is only firing the alert once, on the initial load. This doesn’t fire again if the report is refreshed, or a parameter changed. Am i doing something wrong or missing something? I have to have access to the current values of the report, it would be very nice to have access to the state of the current report in case of there being some interactivity or sub reports.

  • Posted 13 February 2023, 8:31 pm EST

    Hello,

    Yes, the reportLoaded event occurs only once.

    I posted ARJ-4750 to the development team to address your request, and I will keep you informed about the progress

  • Posted 14 February 2023, 2:18 am EST

    Hello,

    Here is the solution to track parameters values changes:

    1. save the reference to the report object in the reportLoaded event handler

    2. in the documentLoaded event handler, check the “parameters” property of the saved report object:

      var viewer = new ActiveReports.Viewer(“#viewer-host”, { language: “en” });

      var report;

      viewer.reportLoaded.register(function(args){

      report = args.report;

      })

      viewer.documentLoaded.register(function () {

      console.log(report.parameters);

      });

  • Posted 14 February 2023, 3:52 am EST

    Thanks, that worked perfectly so far. I tried something similar with the params array but i must have done something wrong because my way didn’t work but this looks to be what i need.

  • Posted 20 February 2023, 11:59 pm EST

    Hi guys, have the same issue with Angular, when i subscribe to document loaded event and try to log into console during drill through but see only initial params

Need extra support?

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

Learn More

Forum Channels