Skip to end of metadata
Go to start of metadata

 

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.
 

 


On this page ...

 

 

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 that data type 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."

 

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.

 

Omitting the quotation marks would result in an evaluation error.

 

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.

 

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

 

 

 

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.

 

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

 

 

Quick Reference

 

Reference TypeRequire Quotes?Expression Example
Static StringRequires Quotes
"This is a string"
String UDT ParameterRequires Quotes
"{turbine_location}"
String Tag ReferenceNo Quotes
{[.]String Tag}
String UDT Parameter with Static StringRequires Quotes
"The turbine is located at {turbine_location}"
String UDT Parameter with String Tag ReferencePartial Quotes 
"{turbine_location} " + {[.]String Tag}
String Parameter, Static String, and String Tag Reference Partial Quotes
"The Turbine " + {[.]String Tag} + " {turbine_location}"

 


Related Topics ...

 

  • No labels