UDT tag Transform

I am trying to achieve the Transform/mapping function on a large scale. I have a event tag that will input a number based on that number i want to pick the event that is happing. This is easy if it was 1 or 2 events but i have couple hundred. So based on a number between 1 and 1000 i want to look up a constant text. What would be the easiest way . I have a 2 column database that is holding the key and values. I attempted like a switch case and looked into dictionaries. Any help appreciated.

See if this thread helps you any.
Mapping a tag output from 1000 input values - Ignition - Inductive Automation Forum

ya i been looking at that post . There refences but they all contain errors . Hard to follow

so far what i have is a label with the event tag and a transform script setup like the above post. it makes sense but giving script errors .


What is Event_Map and where is it defined in the script?

Just putting Event_Map.get_event() probably isn’t good enough.

also, do you have a value for 0

I would use excel to concat inserts for an SQL table instead of using a dictionary. At least that is the path I found.

If it’s already in the database, why not use a named query to get your string?

2 Likes

I think a named query would be the way to go as @JordanCClark mentioned, but just for reference, the transform script would be much cleaner like this

return Event_Map.get_event(value)
1 Like

sorry i said database i ment dictionary …

I have it working now with the above script . @dkhayes117 ill try that out thanks

Way cleaner thank you

1 Like