Input Box Expressions
This page is for widget users editing settings fields.
Where It Works
Works in text-style inputs, including:
formatted text inputs
Tango attribute/device path inputs
attribute name lists
generic string lists
Quick Syntax
Variable token:
{VAR}Numeric expression:
{0+1}Expression with variables:
{{A}+{B}}Supported operators:
+,-,*,/,%,^Parentheses:
{{({A}+1)*2}}
Most Used Examples
{SUBARRAY_ID} -> 01
{{SUBARRAY_ID}+1} -> 02
{{SUBARRAY_ID}-1} -> 00
{{SUBARRAY_ID}*2} -> 2 (when SUBARRAY_ID=01)
{{A}+{B}} -> 13 (A=10, B=3)
mid-cbf/control/{{zpad(0+1,2)}}/VccUnits/state -> mid-cbf/control/01/VccUnits/state
CBF-SA-{SUBARRAY_ID} -> CBF-SA-01
Path Examples
mid-cbf/subarray/{SUBARRAY_ID}/healthstate
mid-cbf/control/{{SUBARRAY_ID}+1}/VccUnits/healthstate
mid-cbf/control/{0+1}/VccUnits/adminMode
Legend/Path Token Examples
These tokens are useful when formatting based on legendFullName:
{fullname}
{split(0)} -> first path segment
{split(-1)} -> last path segment
{split(1:3)} -> path slice [1,3)
{match('subarray/(\\d+)')} -> regex capture (or full match)
{space([1],'-',2)} -> insert '-' before position 1 in segment 2
{replace({split(3)},'_ErrorStatus_errErrorActive','')}
Concrete replace example:
legendFullName: mid-dish/ds-manager/SKA001/Azimuth_ErrorStatus_errErrorActive
{split(3)} -> Azimuth_ErrorStatus_errErrorActive
{replace({split(3)},'_ErrorStatus_errErrorActive','')} -> Azimuth
space — insert a character at positions within a path segment
space(positions, char, segmentIndex) splits a path segment at the given character positions and
rejoins with char. Positions are 0-indexed and mark where the new character is inserted before
the character at that position. Out-of-range or zero positions are silently skipped.
legendFullName: tango/device/vvoltage
{space([1],'-',2)} -> v-voltage (segment 2 = "vvoltage", split before index 1)
legendFullName: tango/device/acurrent
{space([1],'/',2)} -> a/current
legendFullName: tango/device/hepowersupply
{space([2,7],' ',2)} -> he power supply
{space([1],'-',-1)} -> same as using the last segment (index -1)
Function Examples
Built-in functions are available in expression form:
{{sum({A},{B},{C})}}
{{avg({A},{B},{C})}}
{{min({A},{B})}}
{{max({A},{B})}}
{{clamp({A},0,100)}}
{{round({A}/3,2)}}
{{floor({A}/3)}}
{{ceil({A}/3)}}
{{abs(-{A})}}
{{sqrt({A})}}
{{pow({A},2)}}
{{log({A},10)}}
{{zpad({A},2)}}
Keep leading zeros after math
Use zpad(value, width) when you need fixed-width numeric output.
{{zpad({SUBARRAY_ID}+1,2)}} -> 02 (if SUBARRAY_ID=01)
{{zpad(min({SUBARRAY_ID},1),2)}} -> 01 (if SUBARRAY_ID=11)
mid-cbf/vccunit/{{zpad(min({SUBARRAY_ID},1),2)}}/healthState
Troubleshooting
Use
{VAR}for direct value substitution.Use
{{ ... }}for arithmetic/functions.If you see the token unchanged in output, the variable is likely missing at runtime.