Skip to end of metadata
Go to start of metadata

This function is used by Ignition's Expression language.

Description

 Returns an object representing the value of the Tag at the path specified. Normally, you'd use the expression language's built-in bound-value syntax to use a tag value in an expression. What makes this function useful is that the path itself can be the result of an expression, meaning it can be dynamic. The object returned by the function may need to be converted to a standard data type. Check out the Type Casting functions for more information.

When using the tag() function in a logic function, the tag value will remain subscribed to, even if the logic function chooses a different outcome. This can affect tags that are on a leased scan class.

Syntax

 tag(tagPath)

  • Parameters

string tagPath - The tag path to the tag.

  • Results

object - The value of the tag. The object returned by the function may need to be converted to a standard data type using one of the various Type Casting functions.

Examples
Code Snippet
tag("Tanks/Tank5") //returns Tank5's value.
Code Snippet
tag("Tanks/Tank" + {Root Container.TankNum}) //returns the value for the tank represented by the dynamic property TankNum on the Root Container.
  • No labels