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 7.8

Transcript

(open in window)

[00:00] Parameters are similar to Custom Properties on Vision Components, and they evaluate whenever the report's executed. When you create a new report, there are two parameters created by default, Start Date and End Date. End Date is just like a "now" expression, whereas Start Date's using "now" and "Data Arithmetic". Note that you can delete or alter these, if you'd like. So, for example, go ahead and change this to a day ago. You take a look in the Design Panel. I have some text shapes set up with our parameters, as well as some text to the front, just so we know which value is which. If we check the Preview panel, you'll see that the Start Date is one day before the End Date. Now let's add a couple more parameters. Go back to Data, click on the Plus icon, add New Parameter. Call this Int Value. And we'll change the Parameter Type to Long. Now, you can type in any value you'd like for this. However, for the default expression, we'll go ahead and use this Integer Tag I have. When this report's executed, the value of the parameter will match whatever the value on the Integer Tag is. Let's add a couple more parameters. Click on the Plus icon, type String Value. And we can just give it a default value of "My Default". Now, it's important to note you can also reference one parameter from another parameter. We'll go ahead and test that out. We'll do, Plus, click the Plus icon, New Parameter, call this Reference. Now, if you'll note, there is no little icon that allows you to add a parameter. However, we can type in the name of our parameter with an open curly brace, and then the name of the parameter, "String Value" in this case, or whatever the name of the parameter is. And that's really it. So, when the report executes, the value of Reference will be whatever the value of String Value is. So, we can concatenate some additional text here. So, now the value of our parameter contains a reference to a different parameter, in addition to a string value. Next, we need to add our parameters into our report. We'll come over to the Key Browser, we'll open up Parameters, we'll find Int Value, drag and drop it onto our report. Now, note when you do this, new text shapes are macro-created. This happens for any parameter whenever you drag and drop it onto the report. We'll add some text here. Let's make it a little bit easier to read. Now, for reference, we already did that in the default value, so we don't need to do anything other than drop this on the window. Give it a little room here. Look on Preview. You'll see that the Int Value is a thousand subtexts, you're on a thousand right now. And then my default is the default value, the String parameter. Now, there is one limitation in regard to parameters referencing other parameters. If you look at the Data panel, you'll see that Reference is below String Value. Parameters can only ever reference other parameters that are listed above them. So, for example, if we swapped places with these two, so now Reference is above String Value, we take a look at the Preview mode, you'll notice our reference to String Value is blank. So we'll go back to the Data panel. We'll reorder our Parameters. And let's take a look at this in the Report Viewer component. We click on this Report Viewer component I already set up for us here. We scroll down to the Property Editor. You'll see all of our report parameters appear right down here. Now, we can go ahead and update the value of these, as we like. So, 500. Now Int Value shows 500. However, we can also use Tag or Property Bindings to update the values of our parameters. If we take a look in our Tags folder, we have the String Tag. We can just drag and drop that down to our String Value parameter. And now we can type something into the String Tag to update it. So, Another Test. And you see it updates immediately. Additionally, we can use our Property Binding on the Date Range Selector. We change the Select a Date range, the values on our parameters update.

You are editing this transcript.

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