Multi State Tags

Hello,

I am adding tags from a PLC. It is a multi state tag. When the tag has a number 1= production. A number 2= Clean mode and a number 3= manual mode. I am adding this to one of transaction groups. How do I allow my transaction group to state "manual mode when the PLC tag reads 3, and "Clean Mode" when PLC tag reads 2? In the HMI program on the machine it is considered a multi state indicator.

Option 1:
In your transaction group items, instead of using the raw tag, right click and add an expression item. Use a case to map the integer to a string value. Then set the expressions item's target type to a database field with a target name that matches your DB field.

case({[~]PLC/State},
	2, 'Clean Mode',
	3, 'Manual Mode',
	'Production'
)

image

Option 2:
Just log the integer value in your database and create a translation table in the db that you would join on your history table to map the integers to string values. I use this method myself.

1 Like

This. Especially if you have more than one similar application.

I would recommend storing the digital value in the database and doing an expression mapping transform to convert the values to text at the point of display. This also has the benefit of making your database international because you can apply translations in the Ignition application.

1 Like