Parameters

Parameters provide a way to create generic sources (Inputs, Instances, and Pipelines) that take arguments to return different results. This is similar to functions in programming that take arguments.

Here are a few examples:

  1. An OPC UA tag input that takes a tag address parameter that’s used to control the tag that is read
  2. A Mixer Instance that takes the mixer identifier which is used to scope a SQL query to return the current batch information for the mixer
  3. A getWorkOrder pipeline that takes the line number and returns the current work order for the line

Below are examples of how to use parameters for Inputs, Instances, and Pipelines.

Input & Instance Parameters

Input and Instance Parameters are configured in the same way. Navigate to the details page of the Input or Instance and select the Parameters tab. This launches a UI that allows you to define the parameter names and default values.

In this example a single parameter named lineID is defined, with a default value of zero. Parameters are always a flat list of attributes, and for Inputs and Instances they are string types.

Parameter Example

Once configured, navigate back to the details view and you’ll see the defined parameters at the top. You can now use this parameter in the Input or Instance by using the {{this.parameterName}} syntax. In the below example the lineID is used to construct the tag identifier.

OPC UA Input Parameter Example

Now when referencing this Input in an Instance or Pipeline, you’ll see the parameters and be able to fill in the values.

Here is an example of using this Input in an Instance attribute reference.

Instance Attribute Reference

Here is an example of using this Input in an Instance attribute expression. Note expressions take parameters in JSON format.

Instance Attribute Expression

Instance Parameters

Instance parameters work the same as Input parameters. Below is an example of using a parameter in an attribute expression field; both as a static value and passing it to a source. Note the expression fields replace the {{this.param}} syntax before executing JavaScript.

Instance Expression with Instance Param.png

Pipeline Trigger Parameters

Pipelines can take Parameters through Callable or API Triggers. In both cases the Parameters are defined on the trigger similar to how they are configured for Inputs and Instances. The biggest difference is trigger parameters can set a data type.

Below is an example of a Callable Trigger that takes two arguments; machineID and a message to create a workorder.

Pipeline Trigger Parameters

Once defined, Callable Trigger parameters are exposed to Namespace nodes that reference the Pipeline. Below is an example.

Namespace Node Pipeline Parameters

Parameter Data Types & Default Values

Parameter data types are enforced, and if a call is made with an invalid data type the read will fail. If a parameter does not have a default value, and no value is provided during the read, the read will also fail.