LESSON

Parameters

Description

Parameters are similar to custom properties on a Vision component. Learn how to create and configure default values for parameters.

Video recorded using: Ignition 8.1

Transcript

(open in window)

[00:00] In this lesson, we'll go over creating report parameters and configuring their default values. Parameters are similar to custom properties on prospective and vision components and they evaluate whenever a report is executed. When you first create a report, you'll start with two parameters start date and end date. If we look at the default value expressions. We can see the end date is simply pulling the current time. And start date is using date arithmetic on the current time. It defaults to now minus eight hours, but we can modify the expression and change it to something like 10 days ago. New parameters can be added by clicking the plus button and selecting new parameter. I'll call this into value. And I'll change the type to a long. Now I could type in any literal value here. But instead I'll bind the default value to a tag I have.

[01:09] I can click the tag icon. Select my integer tag. And click ok. When the report is executed the value of the parameter will match the value of the integer tag. Let's add some more parameters. I'll create another one and call it string value. I'm going to give this a default value of my default. Since this is using expression language syntax. I need to make sure my string literal is wrapped in quotes. Another thing that you can do is create a parameter that references another parameter. I'll create a new parameter and call it reference. There's nothing here to click to add a reference to another parameter. So we'll have to manually type it inside of curly braces.

[02:04] Be sure to match the spelling in case or else it won't evaluate. I'll add a curly brace. The name of the parameter that I want to reference in my case string value. and the closing curly brace this will evaluate to whatever the value of string value is when the report is executed. This allows us to do things like concatenate additional text like so keep in mind that the ordering of the parameters matters a parameter can only reference another parameter that is already been defined above it. If I were to move the order of these parameters. The reference wouldn't work. Next thing we'll take a look at is adding our parameters to our report. Let's head over to the design tab. Over here in the key browser. There's a folder called parameters.

[03:03] I'll start clicking and dragging the parameters over to the report. You can see that this automatically creates a text shape with the parameter. This is what happens with any type of parameter when dragged and dropped. I'll add some additional text to these shapes to make them readable. And now we can go over to the preview Tab and test it out. As we can see the N value is pulling a value of 2,000 from my integer tag in my default is showing up within the reference parameter. It's important to note that the scheduled report and Report viewer component parameters take precedence over default parameters. So any default parameter values can easily be overwritten? Now, let's take a look at these parameters in a vision report viewer component. I'll click on the report viewer. I've already set up and we can take a look at the property Editor to see the parameters. We can type in new values for these parameters and see the report update.

[04:13] Additionally I can drag and drop a tag onto a parameter to set up a binding and once the tag value changes the report updates. Finally, you can also set up a property binding to Change Report parameters for example with the state range component.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.