Data Type Parameters in Expressions

It is possible to use the value of data type parameters directly in expression bindings within a UDT.

images/download/attachments/6034220/udt_param_button.png

Parameter references can be quickly inserted into expression by clicking on the UDT Parameters button on the right of the expression area

Syntax

The syntax for data type parameters 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.

"{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/6034220/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/6034220/udt_param_string_value.PNG

Omitting the quotation marks would result in an evaluation error:

images/download/attachments/6034220/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/6034220/alarm_example.PNG

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

images/download/attachments/6034220/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/6034220/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/6034220/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}"