Data Type Parameters in Expressions

It is possible to use the value of data type parameters directly in expression bindings within a UDT. Parameter references can be quickly inserted into an expression by clicking on the UDT Parameters button on the right of the expression area.

images/download/attachments/6048402/udt_param_button.png

Syntax

The syntax for data type parameter expressions differs from Tag and property references when using string values. Quotation marks must be used when referencing string parameters. The reason for this is parameter references are replaced before any expressions are evaluated. This differs from Tag and property references seen elsewhere in ignition.

If the data type of the parameter is not a string, then quotation marks are not required, but can be used.

It does not matter if double quotation marks or single quotation marks (" versus ') are used as long as a matching closing quotation mark is present.

Syntax Code Examples
"{string parameter}" //This expression will evaluate successfully
'{string parameter}' //This expression will evaluate successfully as well

Examples

Below is an instance of a Turbine UDT. It contains a string parameter named "turbine_location."

images/download/attachments/6048402/udt_param_expression_tag.PNG

Inside the Turbine UDT is an expression Tag named Member Location. To show the value of the turbine_location parameter on Member Location, the following expression would be used on the UDT definition.

images/download/attachments/6048402/udt_param_string_value.PNG

Omitting the quotation marks would result in an evaluation error.

images/download/attachments/6048402/evaulation_error.PNG

The same syntax should be applied to parameters in bindings on alarm properties. Below is an example using the same UDT, but the expression is instead located on the Display Path property of an alarm.

images/download/attachments/6048402/alarm_example.PNG

Additionally, non-string parameters and static values can be included in the same quotation marks.

images/download/attachments/6048402/int_and_string_alarm.PNG

Combining Parameters and Tag References

Because parameter and Tag references differ in syntax, some consideration must be made when attempting to use both in the same expression. Tag references must not be placed inside of quotes. After adding a string Tag to the Turbine UDT, a reference to the Tag can be added to Member Location's expression.

images/download/attachments/6048402/param_with_string.PNG

Adding quotation marks around the Tag reference would result in the literal value of the reference appearing in the value of the Tag.

images/download/attachments/6048402/param_with_string_all_quotes.PNG

Quick Reference

Reference Type

Require Quotes?

Expression Example

Static String

Requires Quotes

"This is a string"

String UDT Parameter

Requires Quotes

"{turbine_location}"

String Tag Reference

No Quotes

{[.]String Tag}

String UDT Parameter with Static String

Requires Quotes

"The turbine is located at {turbine_location}"

String UDT Parameter with String Tag Reference

Partial Quotes

"{turbine_location} " + {[.]String Tag}

String Parameter, Static String, and String Tag Reference

Partial Quotes

"The Turbine " + {[.]String Tag} + " {turbine_location}"

Similar Topics ...