Multistate Indicator wanted to show Error in Text if the value is out of range

Hi Team,
I have taken one multistate indication, in which there are 6 values.
0 = unknown
1 = block
2 = vent
3 = supply
4 = blocking
5 = venting
6 = supplying

according to the state (0,1,2,3,4,5,6) of the tag, I can show the text ( vent, block, supply...) example - if the value is 2 it will show the text vent. I want to show an error text if the state is 7 8 or in minus. Any help?

Create a custom property and bind your state source to that. Then, do an expression binding on the state property of the multistate indicator that checks the custom property with the state value. Have it return a -1 if out of range, otherwise let it pass the normal value through. Create another state on your indicator with a value of -1 that displays your error message.

Hi Ryan,
Thanks for the response, I am new to this, can you please elaborate? I tried above solution but could not reach it :neutral_face:.
Thanks in advance.

Create a custom property on the multistate indicator by right clicking the specific multistate indicator in the project browser tree and selecting customizers -> custom properties.

Customizer Menu

MultiInd_01

In the dialog, make a new integer property and name it whatever you want.

Custom Property

MultiInd_02

On that new custom property, bind the source of your state value to it. In your case, take the binding from the State property and apply it to this new custom property

Example Binding to custom property

Then make an expression binding on the State property of the indicator that looks something along the lines of

if(
	{New Template.Multi State Indicator.stateSource} >= 0 ||
	{New Template.Multi State Indicator.stateSource} < 7,
	{New Template.Multi State Indicator.stateSource}, -1
)

The exact path to the component/property will vary according to your view's/template's structure.

In your multistate indicator, add a state that looks for value -1, and change the text to display some error text.

Out of bounds state

Now if your state value goes below 0 or above 6, your multistate indicator should show 'Out Of Bounds'

1 Like

Or, add a state at 7 with the same settings as -1. No expression required.

EDIT: Hold on a sec. You may have to clamp your state at -1

Will that fail over gracefully if the value is above 7? I vaguely remember having issues with that at some point, which is when I started doing the expressions.

It's open ended until the next setpoint.

Yep, you would need to clamp the negative value anyway, so you may as well cover the upper ones as well.

2 Likes