Parameters

Adding Parameters function similar to custom properties on Vision windows and components. Their value can be shown directly on your report, or be referenced by data sources and other parameters. Parameters are given a default value when first created, but this value can be overridden once the report runs.

Default Starting Parameters

When you first create a report, you start with two parameters: StartDate and EndDate. EndDate will have a default value of 'now()', while StartDate will have a default value of 'dateArithmetic(now(), -8, "hr")'. Notice how I have changed the default value of the StartDate to be a difference of 10 days instead of 8 hours by modifying the Default Value expression. You can also delete both StartDate and EndDate parameters if you do not need date parameters in your report.

Adding New Parameters

In addition to expressions, you can also have your default value reference a tag, like I have done with this StringParameter.

images/download/attachments/6035687/String.JPG

You can also use a literal value, like I have done for this IntegerParameter.

images/download/attachments/6035687/Int.JPG

Finally, you can reference other parameters, like I have in this BoolParameter. It is important to note that when referencing other parameters, you must type the name of the parameter exactly within a set of curly braces { }. Also, you can only reference parameters that are above the current parameter. So while I can reference the IntegerParameter in the BoolParameter, I can not reference the Bool Parameter in the String Parameter.

images/download/attachments/6035687/Bool.JPG

Designing with Parameters

Now that we have created our parameters, we are ready to put together a report using those parameters. I have made a report and have dragged all of the parameters we created, including the start and end date onto the design section of the report. This way, we can see how all of our parameters behave within the report itself.

images/download/attachments/6035687/Design.JPG

Switching over to the preview tab, we can see that each one of our parameters is now displaying its default value. The end date is showing March 18th, which was the current date at the time, and the start date is showing March 8th, which is 10 days before the current date. Our string parameter is displaying the word "Testing" which is the word that is stored in my string tag, the integer parameter is displaying the static number we placed in as a default value, and the boolean parameter has a value of 0 or false, because our integer parameter is not equal to 1000.

images/download/attachments/6035687/Preview.JPG

Manipulating the Parameters in the Report Viewer

When we view our report in the Report Viewer component on a vision window, we will at first see our default parameter values on the report. All of our parameters are listed in the property editor under the Report Parameters section. You will notice that I have manually entered in a value for the string parameter, and that parameter on our report updates to reflect the new value. You can also see that our string tag has not changed, nor will changing the string tag change our parameter. It is important to distinguish that setting the default value of a parameter is not the same as binding it. The default value will be used if there is no value in that parameter. Since I have placed a static value of "My Test into that string parameter, the report viewer on this page will always display "My Test" as the value of that parameter, regardless of what the value of the tag is.

images/download/attachments/6035687/StringTest.JPG

We can also bind values to the report parameters to make them dynamic. This allows us to use other on screen components to manipulate the reports parameters. I have bound the start date and end date parameters to the start and end date properties of a Date Range component. You can see that by moving the date range slider, we can easily manipulate the start and end date parameters of our report.

I have also bound the integer parameter to the numeric text field. You will notice that the value of the parameter reflects the value of the numeric text field. We can also see that because we have not put in a value for our bool parameter, it is still using the default value, which is true when the integer parameter is 1000. You can see that the bool parameter has updated in the report to reflect that.

images/download/attachments/6035687/FinalTest.JPG

Next...