Versions Compared
Version | Old Version 8 | New Version 9 |
---|---|---|
Changes made by | ||
Saved on |
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Expressions
Expressions allow complex Tag-based logic to set a property. Expressions can be broken down into two phases: the math phase and the formatting phase. In the math phase, users can use tags to compute mathematical operations to get a single value. The formatting phase is intended for display purposes. Formatting options include specifying the number of decimals for a number date, time string format, etc.
Math
The math phase will always return a single numeric value. This phase is similar to a calculator where the only allowed inputs are tag values, constants, and operations on those values.
All constants are treated as doubles, including boolean values (1.0/0.0)
Format
The format phase will always return a single string value. This phase will convert the math value from the math phase into a string value.
Built-in Operations
Math Operators
Here are the Math operations in Tag Expressions.
Tag ( [] )
Constants ( pi , epsilon , inf )
Basic math operators ( + , - , * , / , % )
Functions ( min , max , avg , sum , abs , ceil, floor, round, exp, log, log10, log , pow, root, sqrt, clamp )
Trigonometry ( sin , cos , tan , acos , asin , atan , atan2 , cosh , cot , csc , sec , sinh , tanh )
Equalities ( == , != , < , <= , > , >= )
Control ( if, then, else )
Format Operators
Item | Description | |
round(decimalPlaces) | Returns a number rounded to the nearest | |
base(base) | Returns a string equivalent of the input number according to the specified base. | |
numericFormat(format) | Returns a string formatted by the pattern described in the format. Invalid formats will return an empty string. | |
# | Denotes a basic decimal character. If used past a decimal point, it will specify the minimum number of decimal values to show. Not compatible with hexadecimal formats. | |
H | Denotes a hexadecimal character. This is not compatible with decimal formats. | |
0 | Denotes a zero-fill character. The index of this character will be used as a minimum number of digits to display before a decimal point. There should be at most one. | |
. | Denotes a decimal point. There should only be one at most. Not compatible with hexadecimal format. | |
, | Denotes a group separator. The index of this character will be used as the number of digits to group up. There should be at most one, and it cannot be used past a decimal point. | |
datetimeFormat(format) | Returns the UNIX timestamp as a string in the form described in format. | |
h | An hour without a leading zero. It can be either 0 to 23 or 1 to 12. | |
hh | An hour with a leading zero. It can be either 00 to 23 or 01 to 12. | |
H | An hour without a leading zero. It can be either 0 to 23, even with AM/PM display. | |
HH | An hour with a leading zero. It can be either 0 to 23, even with AM/PM display. | |
m | A minute without a leading zero (0 to 59) | |
mm | Minute with a leading zero (00 to 59) | |
s | The whole second, without any leading zero (0 to 59) | |
ss | The entire second, with a leading zero where applicable (00 to 59) | |
z | The fractional part of the second, to go after a decimal point, without trailing zeroes (0 to 999). | |
zzz | The fractional part of the second, to millisecond precision, including trailing zeroes where applicable (000 to 999). | |
AP or A | Use AM/PM display. | |
ap or a | Use am/pm display. | |
t | The timezone. | |
d | The day as a number without a leading zero. | |
dd | The day with a leading zero. | |
ddd | The abbreviated localized day name. It uses the system to localize the name. | |
dddd | The long localized day name. It uses the system to localize the name. | |
M | The month as a number without a leading zero. | |
MM | The month as a number with a leading zero. | |
MMM | The abbreviated localized month name. It uses the system to localize the name. | |
MMMM | The long localized month name. It uses the system to localize the name. | |
yy | The year as a two-digit number. | |
yyyy | The year as a four-digit number. | |
map(format) | Returns the value that falls in the range provided in the format based on the input value. The following is the expected syntax of the format:
| |
hasPermission(permission) | Returns whether or not the currently signed-in user has permission. This is the expression equivalent to the script with the same name. System.hasExpression. |
Examples
Item | Description |
Get Tag |
|
Add two tags together |
|
Add two tags together, then return value as binary |
|
Conditional Value |
|
Convert C to F |
|
Embed values into a string |
|
Map values from a range |
|