| name | ignition-expressions |
| description | Ignition expression language reference โ 104 functions. Use when writing tag expressions or Perspective binding expressions. |
| user-invocable | false |
Ignition Expression Language Reference
Ignition expressions are used in tag expression bindings and Perspective property bindings. They are NOT Python โ they use a distinct function-based syntax.
Syntax
if({[.]value} > 100, "High", "Normal")
dateFormat(now(5000), "HH:mm:ss")
tag("[default]Path/To/Tag")
runScript("project.library.myFunc", 5000, arg1)
Property references: {this.props.value}, {view.custom.myProp}, {view.params.x}, {[.]tagProperty}
Functions (104 total)
Math (12)
abs(value) โ Absolute value
ceil(value) โ Round up
floor(value) โ Round down
log(value) โ Natural logarithm
max(a, b) โ Greater of two values
min(a, b) โ Lesser of two values
mod(dividend, divisor) โ Remainder
pow(base, exponent) โ Exponentiation
rand() โ Random double 0.0-1.0
round(value) โ Round to nearest integer
signum(value) โ Sign (-1, 0, 1)
sqrt(value) โ Square root
String (24)
concat(str1, str2, ...) โ Concatenate strings
endsWith(string, suffix) โ Suffix check
indexOf(string, substring) โ First occurrence index (-1 if not found)
left(string, count) โ Leftmost characters
len(string) โ String length
lower(string) โ To lowercase
ltrim(string) โ Remove leading whitespace
mid(string, start, length) โ Substring by position and length
numberFormat(value, format) โ Format number (Java DecimalFormat)
regexExtract(string, pattern) โ Extract regex match
repeat(string, count) โ Repeat string
replace(string, search, replacement) โ Replace all occurrences
reverse(string) โ Reverse characters
right(string, count) โ Rightmost characters
rtrim(string) โ Remove trailing whitespace
split(string, delimiter) โ Split into array
startsWith(string, prefix) โ Prefix check
substring(string, start, end) โ Substring by indices
toStr(value) โ Convert to string
trim(string) โ Remove surrounding whitespace
unicodeNormalize(string, form) โ Unicode normalization (NFC, NFD, NFKC, NFKD)
upper(string) โ To uppercase
urlDecode(string) โ URL decode
urlEncode(string) โ URL encode
Date/Time (16)
dateArith(date, field, amount) โ Add/subtract from date field ("hour", "day", "month")
dateDiff(date1, date2, field) โ Difference in field units
dateExtract(date, field) โ Extract field ("year", "month", "day", "hour")
dateFormat(date, format) โ Format date (Java SimpleDateFormat)
dateParse(string, format) โ Parse string to date
daysBetween(date1, date2) โ Days between dates
hoursBetween(date1, date2) โ Hours between dates
millisBetween(date1, date2) โ Millis between dates
minutesBetween(date1, date2) โ Minutes between dates
monthsBetween(date1, date2) โ Months between dates
now(pollRate) โ Current date/time. Always specify rate: now(5000) or now(0)
secondsBetween(date1, date2) โ Seconds between dates
setTime(date, hour, minute, second) โ Set time components
toDate(value) โ Convert to date (epoch millis or string)
weeksBetween(date1, date2) โ Weeks between dates
yearsBetween(date1, date2) โ Years between dates
Logic (8)
choose(index, value0, value1, ...) โ Select by 0-based index
coalesce(value1, value2, ...) โ First non-null value
hasChanged(value) โ True if value changed since last evaluation
if(condition, trueValue, falseValue) โ Conditional
isNull(value) โ Null check
previousValue(value) โ Previous evaluation's value
qualify(tagPath) โ Qualify tag path with current provider
switch(value, case1, result1, ..., default) โ Case matching
Type Casting (7)
toBool, toColor(r,g,b), toDataSet, toDouble, toFloat, toInt, toLong
Dataset (10)
avg(values...) โ Average
columnCount(dataset) โ Column count
dataSetToJSON(dataset) โ Dataset to JSON string
forEach(dataset, expression) โ Evaluate per row
getColumn(dataset, columnIndex) โ Column as array
hasRows(dataset) โ Has at least one row
jsonToDataSet(json) โ JSON to dataset
lookup(dataset, lookupCol, lookupVal, resultCol) โ Column lookup
rowCount(dataset) โ Row count
sum(values...) โ Sum
JSON (8)
jsonDecode(json) โ Parse JSON
jsonDelete(json, path) โ Remove at path
jsonEncode(value) โ Serialize to JSON
jsonKeys(json) โ Object keys
jsonLength(json) โ Array/object length
jsonMerge(json1, json2) โ Deep merge (json2 wins)
jsonSet(json, path, value) โ Set at path
jsonValueByKey(json, key) โ Get by key
Tag Quality (7)
hasQuality(value, quality) โ Check quality code
isBad(value) โ Bad quality
isGood(value) โ Good quality
isNotGood(value) โ Not good quality
isUncertain(value) โ Uncertain quality
tag(tagPath) โ Read tag value
tagCount(folderPath) โ Count tags in folder
Color (2)
chooseColor(index, color0, color1, ...) โ Select color by index
colorMix(color1, color2, bias) โ Blend colors (0.0=color1, 1.0=color2)
Advanced (10)
binDecode(string, encoding) โ Decode binary (Base64, Hex)
binEncode(data, encoding) โ Encode binary
forceQuality(value, qualityCode) โ Set quality code
getMillis() โ Current epoch millis
htmlToPlain(html) โ Strip HTML tags
isAuthorized(requiredRoles...) โ Security role check
mapLat(value) โ Latitude from map coordinate
mapLng(value) โ Longitude from map coordinate
runScript(scriptPath, pollRate, args...) โ Call project script
typeOf(value) โ Type name string
Key Tips
now() defaults to 1000ms polling โ always use now(5000) or now(0)
runScript("project.library.func", 5000, arg1) calls project scripts from expressions
- Avoid
getSibling(), getParent(), getChild(), getComponent() โ break on restructure
- Property refs:
{this.props.X} (own), {view.custom.X} (view), {view.params.X} (params)