Multi-State Color is a Visual States behavior for a component that has several mutually exclusive operating states and needs to show them by priority. You write up to 8 conditions, each a short expression that returns true or false. At runtime the conditions are checked top to bottom; the first one that is true becomes the current state, and that row's fill color, border color, and visibility are applied to the component. Condition 1 has the highest priority (the editor hints "Rule 1 has top priority."). If none of the 8 conditions is true, an optional Else fallback row can take over. The difference from State Color (two states) is that State Color only has a true/false pair, while this behavior takes the first matching condition by priority, which fits three or more states.
Colors
Colors: Multi-State Color
Rank up to 8 conditions by priority; the runtime picks the first condition that is true as the current state and applies that row's fill, border, and visibility. Best for mutually exclusive operating states such as alarm first, then manual, then auto, then idle.
What it is and what it is for
Multi-State Color is a Visual States behavior for a component that has several mutually exclusive operating states and needs to show them by priority. You write up to 8 conditions, each a short expression that returns true or false. At runtime the conditions are checked top to bottom; the first one that is true becomes the current state, and that row's fill color, border color, and visibility are applied to the component. Condition 1 has the highest priority (the editor hints "Rule 1 has top priority."). If none of the 8 conditions is true, an optional Else fallback row can take over. The difference from State Color (two states) is that State Color only has a true/false pair, while this behavior takes the first matching condition by priority, which fits three or more states.
How to use it: the editor fields
Bind it by dragging the behavior from the right list onto the component node on the left, then double-click to open the editor. The condition list, top to bottom, is the priority order; the action columns set the output per row for each enabled channel.
Definition (optional): preparation area to read tags and define helper values; leave it empty if not needed.
Conditions (1-8): one true/false expression per row; the row number is its priority, row 1 highest, and the runtime uses the first row that is true.
Use Else: when checked, adds an Else row at the bottom of the condition list, used when no condition is true.
Fill (enable via the column header): set one fill color for each state row.
Border (enable via the column header): set one border color for each state row.
Visible (enable via the column header): set show or hide for each state row.
Quality Override: enable Quality Border to set good/bad communication-quality border colors, with an optional 'hide when quality bad'.
// Definition (prepare)
var st = ReadTagInteger("PLC1.PUMP.STATE", 0);
var alarm = ReadTagBoolean("PLC1.PUMP.ALARM", false);
// Condition 1 (highest priority, alarm)
alarm === true
// Condition 2 (manual)
st === 2
// Condition 3 (auto running)
st === 1
// Else fallback: idle
When to use it
Use it when one component must show three or more mutually exclusive operating states that have a clear priority.
Pump/device status lamp: alarm shows red first, then manual orange, then auto-running green, then idle grey.
Multi-level run state: stopped / low speed / high speed / fault on a single shape switched by priority, instead of stacking several behaviors.
Common mistakes
A few pitfalls tied to 'first matching condition wins':
Order decides the result: the first true condition wins, so put the more important state (e.g. alarm) earlier or an earlier true condition will steal it.
Conditions are expressions, not colors: a condition row only returns true/false; colors are set in the action columns, and an empty condition is treated as false.
None true with no Else: this behavior leaves the component unchanged; enable Use Else if you need a fallback.
Enable the channel in the header first: if Fill / Border / Visible is unchecked, that column has no effect on any row.
Quality is communication quality: Quality Border reflects tag comms, not the process value; do not keep showing a valid-looking state when quality is bad.
Figure 1: Multi-State Color editor
Rank up to 8 conditions by priority; the first true one wins and applies that row's fill, border, and visibility.