Is there a way to simulate a multi-state indicator in Perception

Is there a mutli-state indicator or a way to simulate one in perception. They are terribly helpful.Thx, jake

A multi-state indicator in Vision is basically just a label with a custom property defined called ‘state’, which then has a style customiser defined.

Im not sure about for Perception :slightly_smiling_face:, but for Perspective you can do a similar thing. Create a custom property called ‘state’, then bind the properties you want to change to that with case statement expressions. You could define some Perspective Styles which you could then bind to the props.styles.classes property. Otherwise you’ll need to add the styles you want to bind to and individually bind expressions to them. Albeit it’s not as easy as using the style customiser in Vision, it’s certainly far more powerful and standardisable

1 Like

The blinking was cool, but we can live without that. So could I just have memory tags with the colors and text and then use script to set that data in the label based on the opc tag?

Using defined perspective styles, you can have blinking. Use the animation to animate between two style properties.
Dont using memory tags, use Perspective Styles. These can define all of your styling properties: bg colour, text colour, font typeface, font size, borders, shadows, etc etc. Create a style for each of your states, then assign that style to the props.styles.classes property

Would rather build it in code, we literally have around 100 states for 10 or so unit types:).

Then automate the creation of your styles which should be relatively simple. This is by far the best option in terms of efficiency and performance

Styles are a bit new to me. How do I create styles, globally I suppose, and then swap them out in script?

Yep. Above Views in the project browser under Perspective, there’s a Styles section. I have styles for example for all my device statuses which I use for any device states that define the colours etc to use for running, stopped, faulted, etc states. One location for all to make maintaining them easy and to make them consistent across the project. In the props.styles.classes property you can then just bind this to a case statement that looks at your status tag value and write the path to the style based on status value. You can combine styles as well, just put a space between paths. Note that multiple styles use precedence based on the alphabetic order of the styles applied

I’m seeing how I would do this. So in each specific view I would have a label with a specific script and case statement that will choose the correct style, which contains color and text. So here’s another question. I have a script that would generate the xml for the multi-state indicator so when a unit with different states came online I could generate a new indicator in seconds. Can I import those styles, in json I’m assuming, into the styles for the project?

I can have it generate the case statement as well to copy and paste into the new label.

I see a way to export styles but not import then, doesn’t seem very useful. So does that mean it would be best to ditch styles or are they going to put this feature in soon?Thx, Jake

You can import them via the File menu. That’s the same for any other component as well, it’s a little un-intuitive…
Alternatively, you can edit resources directly or add new resources directly from the project resource directory (C:\Program Files\Inductive Automation\Ignition\data\projects\<PROJECT>\com.inductiveautomation.perspective\style-classes\...)