# Report parameters from Perspective custom props

**URL:** <https://forum.inductiveautomation.com/t/report-parameters-from-perspective-custom-props/73668>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [May 12, 2023, 8:06pm UTC](https://forum.inductiveautomation.com/t/report-parameters-from-perspective-custom-props/73668 "2023-05-12T20:06:42Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [May 12, 2023, 8:06pm UTC](https://forum.inductiveautomation.com/t/report-parameters-from-perspective-custom-props/73668/1 "2023-05-12T20:06:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 12, 2023, 8:09pm UTC](https://forum.inductiveautomation.com/t/report-parameters-from-perspective-custom-props/73668/2 "2023-05-12T20:09:44Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [May 12, 2023, 8:15pm UTC](https://forum.inductiveautomation.com/t/report-parameters-from-perspective-custom-props/73668/3 "2023-05-12T20:15:35Z")

</div>

I'm sorry, I'm not understanding.

I should set up the report viewer first, then the report designer?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 12, 2023, 8:20pm UTC](https://forum.inductiveautomation.com/t/report-parameters-from-perspective-custom-props/73668/4 "2023-05-12T20:20:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [May 12, 2023, 8:34pm UTC](https://forum.inductiveautomation.com/t/report-parameters-from-perspective-custom-props/73668/5 "2023-05-12T20:34:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 12, 2023, 8:37pm UTC](https://forum.inductiveautomation.com/t/report-parameters-from-perspective-custom-props/73668/6 "2023-05-12T20:37:51Z")

</div>

> [@hw79](#):
>
> There isn't a prop browser.

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.

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [May 12, 2023, 8:48pm UTC](https://forum.inductiveautomation.com/t/report-parameters-from-perspective-custom-props/73668/7 "2023-05-12T20:48:48Z")

</div>

There's still a disconnect between what you're saying and what I'm understanding.

> [@pturmel](#):
>
> Have the NQ in the report use the **report parameters**.

How do I have the NQ use the report paramters? What value do I set them to?

> [@pturmel](#):
>
> Then, in the Perspective view, where you place the viewer, connect the report parameters on the viewer to the custom props as you please.

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.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 12, 2023, 9:03pm UTC](https://forum.inductiveautomation.com/t/report-parameters-from-perspective-custom-props/73668/8 "2023-05-12T21:03:40Z")

</div>

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](https://www.inductiveuniversity.com/videos/reports-in-perspective-sessions/8.1) - jump to about 4:00 in.

> [@hw79](#):
>
> Add params in the props of the ReportViewer? How does that get passed to the report?

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.

---

<div class="post-metadata">

**Author:** ![hw79](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hw79](https://forum.inductiveautomation.com/u/hw79)\
**Post date:** [May 12, 2023, 9:09pm UTC](https://forum.inductiveautomation.com/t/report-parameters-from-perspective-custom-props/73668/9 "2023-05-12T21:09:23Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [May 12, 2023, 9:11pm UTC](https://forum.inductiveautomation.com/t/report-parameters-from-perspective-custom-props/73668/10 "2023-05-12T21:11:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 12, 2023, 9:21pm UTC](https://forum.inductiveautomation.com/t/report-parameters-from-perspective-custom-props/73668/11 "2023-05-12T21:21:09Z")

</div>

> [@MMaynard](#):
>
> report viewer pulled the params like other controls do

Hmmm. Must be a Perspective bug, because Vision's report viewer does this.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 12, 2023, 9:30pm UTC](https://forum.inductiveautomation.com/t/report-parameters-from-perspective-custom-props/73668/12 "2023-05-12T21:30:55Z")

</div>

Well, not yet implemented feature, but yes. I believe a ticket already exists, just hasn't been picked up yet.
