Tag Expressions
About Tag Expressions
Use Tag Expressions to construct simple calculations that can be used on a chart.
You can construct an expression consisting of tags, including tags with special characters, mathematical operators, functions, and other existing expressions, allowing you to plot a calculated tag that would otherwise be handled by analytics. This allows you to display time-series data on the chart and add a tag that calculates a marker or other indicator. Operators must be placed between asset-tag combinations. Tag expressions can be saved on an analysis template
- When you type tag names with special characters for tag expressions, you cannot use Dollar ($), Pipe (|), Colon (:), and Ampersand (&), which are used as symbols to represent various parameters in the tag expressions.
- When you type tag names for an expression and use the lookup for assist, you can skip typing the special characters in the tag name, and continue with the rest of the words. The criteria entered narrows down to the matches. For example, when you search for a tag name TT$NHLogic:Gate10, you can search directly after adding the asset name $<AssetName>|TTNHLogicGate10. You can skip typing the special characters Dollar ($) and Colon (:) that are used in the tag name.
You cannot add additional assets for Event Data Analysis charts in the Tag Tree Browser, Tag Expressions, or Search Browser panes.
- Add or change the tag expression name.
- Enter a description of the tag expression functionality.
- Add additional assets to the Asset Scope.
- Create or modify a mathematical calculation that is usable as a tag during analysis.
- Create or modify a mathematical calculation that includes conditional statements, predefined functions, and allows embedding of existing tag expressions within a new tag expression.
- Define the number of significant digits that appeared for the tag expression.
- Drag a tag expression to a chart.
- View tag expression information as hover-over text.
When creating a tag expression, you can add conditions, predefined functions, and embed an existing tag expression within a tag expression.
- The full tag expression name.
- The description.
- The UoM for the tag expression.Note: If any information is missing for the tag expression, the area in the tool tip is blank.
- Addition – Enter a +
- Subtraction – Enter a -
- Multiplication – Enter a *
- Division – Enter a /
- Remainder - Enter a %
- Exponent - Enter a ^
- Parentheses – Enter ( )
Expressions use symbols for assets ($), tags (|), functions (:), and existing expressions (&).
- $Asset01|tag01|+10+$Asset02|tag02|
- $Asset01|tag01|*$Asset02|tag02|
- (1-$Asset01|tag01|)-($Asset02|tag02|)
- $Asset01|tag01|*2
Tag expressions can be treated like any other tag. For example, you can mute and unmute a tag expression and drag it into another chart.
Tag expressions saved to a template also include value-based filters or conditional filters. Once saved, tag expressions that include filters can be shared to another template.
Tag expressions can be used as one tag in a plotted tag series.
Add the Tag Expressions
Tag expressions allow you to perform quick calculations using tag data.
About This Task
You can create and add a tag expression to a chart that consists of tags and simple mathematical operators, allowing you to add a marker or other calculation relating to the data on the chart.
Tag expressions are treated the same as any other tag, and can be added as a component of a tag series for X-Y and Polar charts. All tags can be filtered, including tag expressions. UoM labels for tags are retrieved automatically. Tags added to a tag expression must match the first tag's UoM. If an embedded tag expression is added first, then the UoM for any additional tags in the tag expression must match the embedded tag expression's UoM. If the first tag is removed in the tag expression, the UoM is blank.
Procedure
Example
Example
Plot a Tag Expression
You can plot a tag expression in the Tag Tree Browser pane.
About This Task
Tag expression can be plotted, muted, and deleted like any other tag. Once a tag expression has been plotted to a chart, you can view it in the Plotted Tags section of the Tag Tree Browser.
When plotting a tag, the source UoM is converted to the standard UoM during plotting.
Procedure
- To plot a tag expression in the Tag Expression pane:
- To plot a tag expression in the Tag Tree Browser:
Modify a Tag Expression
Once it has been created, you can modify a tag expression in the Expression Calculator pane.
About This Task
Tag expressions are managed within a list under the Tag Expressions section.
Procedure
Share the Tag Expressions
You can share tag expressions to templates that are available to you.
About This Task
Tag expressions are calculations using tags for the asset context. You can change tag expressions, save or update them as a template, and then share them with templates that are available to you.
When you share a tag expression on a view, it is applied to one or more selected templates. Templates with shared tag expressions can then be viewed, modified, and associated with an Alert Template. Templates with modified tag expressions affect existing templates associated with the Alert Template. You can share tag expressions across public and private templates.
Tag expressions saved to a template also include value-based filters or conditional filters. Once saved, tag expressions that include filters can be shared to another template.
The name of the shared tag expression can be modified prior to sharing and cannot match an existing tag expression.
When sharing tag expressions, you can select from private templates and public templates associated with the selected asset context for an instance template only. You cannot share a tag expression with a class template. Templates with successfully shared tag expressions are available for additional sharing.
If a shared tag expression's associated tags are not available on the receiving template, the tag expression is invalid cannot be used. An invalid tag expression is disabled and appears.
Procedure
Delete a Tag Expression
You can delete a tag expression in the Expression Calculator list.
About This Task
Deleting a tag expression from the Expression Calculator list, which removes it from the Plotted Tags list in the Tag Tree Browser and all the associated charts in the view. This action cannot be undone.
Procedure
Add Conditions to a Tag Expression
Use conditions to add conditional statements to a tag expression.
About This Task
Conditional statements are used to obtain different results based on different conditions. When you plot a conditional tag expression, the evaluation is plotted.
- Less than - Enter <
- Greater than - Enter >
- Equal to - Enter ==
- Less than or equal to - Enter <=
- Greater than or equal to - Enter >=
- Not equal to - Enter !=
You can create a simple boolean expression, or a complex one using ( ), AND, or OR.
The conditional evaluator can be in the form of a function as follows: IF(CONDITION, TRUE-EXPR, FALSE-EXPR). You cannot embed an IF function within another IF function. The second and third argument in the function must use tags; do not use a value only. Logical expressions always evaluate to either true or false.
It is best practice to use parentheses around each conditional statement to avoid ambiguities during evaluation.
Procedure
Example
:IF(($asset1|tag1| + 1) > ($asset2|tag2| * 10), $asset3|tag3| + 4, $asset4|tag4| - 10)
Example
:IF(((:SIN($asset1|tag1|)+$asset2|tag2|)*3.14) <= (:ABS($asset3|tag3|)/10), ($asset4|tag4| + 4), (1^$asset5|tag5|)*100)
Example
:IF(((($asset1|tag1|) < ($asset2|tag2|)) OR (($asset3|tag3|) < ($asset4|tag4|))), :AVG($asset5|tag5|, -1),$asset6|tag6|/$asset7|tag7|)
Add Predefined Functions to Tag Expressions
Use predefined functions to add statistical or trigonometric functions to a tag expression.
About This Task
- For more information on the predefined statistical functions that are supported, refer to the Statistical Functions topic.
- For more information on the predefined math and trigonometric functions that are supported, refer to the Math and Trigonometric Functions topic.
Procedure
Example
Embed Tag Expressions
You can embed existing tag expressions into another tag expression.
About This Task
Embedding a tag expression into another tag expression allows you to evaluate multiple expressions within one tag.
Tag expressions are treated like any other tag when dragged to a chart. You can save tag expressions plotted on a chart in an Analysis Template.
Tags selected for a embedding into a tag expression must have the same UoM as the current expression. You cannot embed another expression in the formula if the UoMs are different.
Existing tag expressions are added to the current tag expression using an & and the name of the existing tag expression, then placed within the current tag expression.
When the name or formula of an expression is updated, all expressions that embed the updated expression are updated as well.
You cannot delete a tag expression that is embedded within another tag expression. To delete the tag expression, you must first remove it from all other tag expressions.