I'm in the report designer and using a named query that uses a custom prop from my perspective view.
How can I pass that prop into the report so the query runs correctly?
I'm in the report designer and using a named query that uses a custom prop from my perspective view.
How can I pass that prop into the report so the query runs correctly?
When you set up the report viewer, all of the defined parameters on the report will be available to bind to:
https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Report+Viewer
Your report should be considered a "pure" function; the only thing that drives the appearance of the final report are the input parameters.
I'm sorry, I'm not understanding.
I should set up the report viewer first, then the report designer?
You should be running the named query inside the report, via the 'data sources' options. If you're not currently doing that, correct that first.
Then, whatever inputs the named query needs, such as a start and end date, line number, tagpath, whatever it is, should be assigned to report parameters.
Then, wherever you're executing the report (in Perspective, in Vision, on a schedule, via scripting, whatever), you just have to pass the "primitive" values (datetimes, strings, numbers, etc) and allow the report to kick off the named query internally.
In particular for Vision and Perspective, the 'Report Viewer' component automatically recognizes the parameters the report expects, and will allow you to easily bind those parameters to runtime values from the rest of the Vision or Perspective session. The report viewer components will also automatically regenerate the report as those input parameter values change.
I have the named queries as the data source in the report.
When I assign the named query as a data source in the report, I get paramters under the path, but I'm unable to assign the value of the custom prop of the view. There isn't a prop browser.
I thought maybe I had to add a parameter on the left column of the data tab but that wasn't working either.
Because the report is running in a different scope. Define the parameters you need in the report. Have the NQ in the report use the report parameters.
Then, in the Perspective view, where you place the viewer, connect the report parameters on the viewer to the custom props as you please.
They key is that the report cannot and will not ever have access to the props in Perspective. Perspective has to deliver the props to the report's parameters.
It also leaves you the option later to supply those parameters to the report without using Perspective at all.
There's still a disconnect between what you're saying and what I'm understanding.
How do I have the NQ use the report paramters? What value do I set them to?
I also don't understand how to connect the report parameters in the viewer to the custom props. Add params in the props of the ReportViewer? How does that get passed to the report?
I'm not seeing this in the documentation, or I'm not making the connection between the documentation and how to do it.
I'm doing what I think is correct, but on the design page there is a warning for the Parameters missing a default value expression. I don't know what expression to use to link the view to the report.
I'm so sorry, I'm feeling really thick and stupid about this.
Report parameters are input.
You don't reach out in your parameter expression to a Perspective session. You can have a default value in the expression, for testing or debug purposes, or in scenarios where you don't need to populate every parameter. But it's okay for it to be empty, despite the warning - you just have to provide the value from wherever you're executing the report.
Reports in Perspective Sessions Video at Inductive University - jump to about 4:00 in.
So, yes, that, exactly. The component receives the input, sends it to the gateway, the gateway re-executes the report, and delivers the updated report to the component. That all happens more-or-less seamlessly, from your perspective.
Okay, I finally figured it out. I think having to add the parameter value in the query parameters as {XXX} that links it to the parameters that I have to create in the left column. Then add params in the reportviewer named exactly as those.
Feels convoluted.
Thanks for the help!
It would be SOOO much easier if the report viewer pulled the params like other controls do.
Currently you have to manually add them on the viewer and make sure you type each one exactly correct.
Hmmm. Must be a Perspective bug, because Vision's report viewer does this.
Well, not yet implemented feature, but yes. I believe a ticket already exists, just hasn't been picked up yet.