Skip to main content
Version: 7.9

Report Parameters

Parameters

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:

  1. Date
  2. String
  3. Long
  4. Double
  5. Boolean
  6. Dataset

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.

Inductive University

Parameters

Watch the video

What are Parameters Useful For?

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")'. Notice how I 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.

Creating New Parameters

New parameters may be added by pressing the button.

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 button 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.

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 my not reference BoolParameter.