Skip to main content
Version: 8.1

Report Parameters

Inductive University

Parameters

Watch the video

As we covered in the overview, the Data Panel is pretty simple at first glance. When creating a new report, there is an empty list of Data Sources as well as pre-made Parameters. Parameters are Ignition Expressions. These parameters resolve at report execution time and provide a convenient way to dynamically specify content for your report. These expressions are expected to resolve to specific types.

The Parameter Types available in the ComboBox will be familiar to anyone who has used Expressions, and include:

  • Date
  • String
  • Long
  • Double
  • Boolean
  • Dataset
  • Binary Data

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.

How Parameters Are Used​

Parameters share some similarities to Custom Properties in Vision components in that they allow an Ignition user to specify dynamic data to be used in reports at runtime. For example, a manufacturer may want to generate reports for the active production lines every Monday morning, but you don't know ahead of time which production lines will be running. We can create a parameter called activeProductionLines and use an expression or Tag value to determine which lines were active, and use the parameter in a SQL Query datasource to only include data from active lines.

Parameters can be declared with an empty (null) value. In this event, it can be fed values from the Vision Report Viewer component, or in the Report Scheduling panel. The Report Viewer can use parameters to bind to data through Ignition Bindings. If a parameter is supplied a default value in the Report Data panel (we call these default parameters), that value will be automatically be supplied to the Report Viewer component. If a parameter has no default, the Report Viewer and Preview Panel will notify the user that a parameter is undefined. It is important to note that both Scheduled Report and Vision component parameters take precedence over default parameters, so any default parameter can easily be overridden while also providing a baseline value.

note

Default values for parameters are evaluated in the gateway, not by clients. As such, the expressions have a Gateway scope.

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")'. The default value of the StartDate can be modified from 8 hours to 10 days by editing the Default Value expression.

StartDate Default
dateArithmetic(now(), -8, "hr")
StartDate Modified
dateArithmetic(now(), -10, "days")

You can also delete both StartDate and EndDate parameters if you do not need date parameters in your report.

Creating New Parameters​

New parameters may be added by clicking the Add icon.

Once created, a default value should be given to the parameter. In addition to expressions, you can also have your default value reference a Tag using the Tag icon on the right of the expression area.

You can also use a literal value. Normal Expression languages syntax applies, so dates and strings must be wrapped in quotation marks, but numerical values can be written without quotes.

Finally, you can reference other parameters. In the example below, BoolParameter is referencing the value of IntegerParameter.

if ({IntegerParameter} = 1000, 1, 0)

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 { }, including capitalization. Also, you can only reference parameters that are above the current parameter. Thus, while BoolParameter can reference the IntegerParameter, the IntegerParameter may not reference BoolParameter.