Is there way to make an enumeration type tag in Ignition?

I’m just wondering if there is a way to make an actual enumeration type tag in Ignition?
Like where an integer value always equals a text state such as:

Or even more states like:

I know this could be done on an actual screen component, but what if I wanted to read this state directly from the tag value? Is this possible in Ignition at all?


You could create an expression data type that generates that enumeration. We do something similar with the switch expression statement.

Thanks for the reply. So you end up basically have 2 tags? The original integer one with the numerical value, and then a 2nd expression tag with the resulting string?

Yes, you could create an expression string tag to do that for you. This would be your example expression which uses the value from your integer tag.

if({[.]Tag} = 0, “Manual”,
if({[.]Tag} = 1, “Auto”,
if({[.]Tag} = 2, “Cascade”,

Exactly @Tim is showing.

Alternatively you can use the switch statement:

'Manual', //Tag Value = 0
'Auto', //Tag Value = 1
'Cascade', //Tag Value = 2
'Unknown' //Falback
1 Like

I prefer to do this with a lookup expression and a states dataset, it makes it a lot easier if you have lot of devices that use the same states, such as if you have a couple of hundred motors.
Each motor has a state number, but all motor states are the same. You can then enumerate either on the window, or you can create a tag that enumerates and then use that on the window.
So you’ll have the following:
State(integer tag) - a number that indicates what state the motor is in.
States(dataset tag) - a dataset tag that contains an integer and a string representing the state.
In the state types dataset, just have a 2 column dataset such as this:
And whenever you want to enumerate, either in a tag or on screen use an expression:

lookup({States},{State},“State not found.”,0,1)

See the manual for info on the lookup expression. lookup - Ignition User Manual 8.0 - Ignition Documentation

The combo of the lookup expression function and dataset tags is extremely useful!


I wasn’t aware that this existed… I may have to revisit how we do this and change over to this mechanism. Thanks for the information.

1 Like

Great idea!!!
Using lookup I can do even multilingual “Enumerations”.
I have used case() or switch() but this way is much more flexible!!!

1 Like

I have used a SQL table to do that

So I found this thread very useful, and have used it to create a lookup for fault codes received as an integer from the PLC. All works as expected.

However, I would like to have an tag event change script on the enumerated fault tag so that every time it gets a new fault code it evaluates and changes its own tooltip based on the new code. The dataset has the additional column, and it all works from a normal script, but the tag event script doesn’t recognize the “lookup” function. Am I missing something really basic here in how to call that function in the tag event script? Or is it just not available there?

Not available. lookup() is an expression function, for use in expression bindings or expression tags. A tag event is a jython script, not an expression. You can perform the lookup by searching that column with jython, and then extracting the corresponding text, and writing it back to the tag property.

However, tag properties do not necessarily propagate to the UI the way tags themselves do. You are best off performing the lookup expression at the point in the UI where you need it, or perhaps in a session custom property.

Thanks for that, I think I’ll move what I’m doing to the UI. It will be a faceplate popup, so I can do the lookup on open, although I had been hoping that a mouse hover tooltip could be updated.

Use a binding on the tooltip. When the tag changes, the lookup will execute again. Try it.

The tag value supports an expression binding, but the tooltip and documentation only seem to support a parameter binding? Seems like I can only get the lookup to work where I have access to expressions.

I’m not recommending you bind the tooltip and documentation in the tag. I’m recommending you bind the tooltip (mouseover text) in the GUI component you are using. With the lookup() expression function. Which references the tag value. That binding will execute whenever the tag changes and that component is displayed somewhere.

DOH! Now I get it.