What is the most efficient method to combine multiple bool status tags into a single tag to drive a perspective motor SVG state change?
For example, I have a Motor with a separate Fault Tag, Run Tag, and Stopped Tag that all needs to drive the state change on the motor svg symbol in perspective.
Use the binEnc
expression function.
e.g.
binEnc({stopped}, {running}, {faulted})
This will produce a binary encoded value which you can decipher in a case statement:
case(binEnc({stopped}, {running}, {faulted})
,1, 'Stopped'
,2, 'Running'
,4, 'Faulted'
,5, 'Faulted'
,6, 'Faulted'
, 'Invalid'
)
4 Likes
cssbrn
August 21, 2025, 3:29pm
3
How is this for multiple tags?
You need to explain what you require. In general, it would be,
case(binEnc({tagPath1}, {tagPath2}, {tagPath3})
,1, 'Stopped'
,2, 'Running'
,4, 'Faulted'
,5, 'Faulted'
,6, 'Faulted'
, 'Invalid'
)
1 Like
Wished I'd stumbled across this 2 years ago. I do it old school with an expression:
State = fwd + 10*rev + 20 *fault
Then my style customer has values of
0 (stopped), 1(Running fwd), 10 ?Running rev), 20 (fault)
Code enforces that there’s never possibility of 11, 21, etc, but even then I’ll style Invald for those possibilities.