It's possible to perform calculations on data keys. This section documents the various operators and functions that are available.
Keychain Expressions
Keychains have their own expression language that is largely similar in syntax to Java. To separate this language from others in Ignition, we refer to it as a Keychain Expression.
Keychain Expressions are configured by simply utilizing any operators or functions within the "@" characters. Assuming a key named "myKey" with a value of 100, we can multiply its value by 10 with the following expression:
//Expression
@myKey * 10@
//Output
100
Again, note that the "*" operator and multiplier are enclosed in the "@" characters. Of course, we can also use a different key as the multiplier. Assuming we have another key named "myMultiplier" that has a value of 5:
//Expression
@myKey * myMultiplier@
//Output
50
Any characters outside of the "@" characters are not part of the expression, so you can easily add prefixes and suffixes with static text.
//Expression
Total: @myKey * myMultiplier@ gal
//Output
Total: 50 gal
Additionally, you can utilize separate Keychain Expressions in the same TextShape. Note that "myUnits" (which has a string value of "gal") is enclosed in a separate set of "@" characters, since it is a separate expression:
//Expression
Total: @myKey * myMultiplier@ @myUnits@
//Output
Total: 50 gal
Dynamic Data Key Expressions
Keychain Expressions may also be used with Dynamic Data Keys. The syntax and operators work exactly the same, except there is no need to type the "@" characters. Because of this, the entire field is treated as a single keychain expression.
