# UDT tag Transform

**URL:** <https://forum.inductiveautomation.com/t/udt-tag-transform/56725>\
**Category:** Ignition\
**Created:** [March 2, 2022, 3:35pm UTC](https://forum.inductiveautomation.com/t/udt-tag-transform/56725 "2022-03-02T15:35:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![byrcharl](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@byrcharl](https://forum.inductiveautomation.com/u/byrcharl)\
**Post date:** [March 2, 2022, 3:35pm UTC](https://forum.inductiveautomation.com/t/udt-tag-transform/56725/1 "2022-03-02T15:35:09Z")

</div>

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.

 ![2022-03-02_7-34-18](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/c/ec43dec4b402fea928e38167795fbd518d88e5c1.png)

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [March 2, 2022, 3:39pm UTC](https://forum.inductiveautomation.com/t/udt-tag-transform/56725/2 "2022-03-02T15:39:23Z")

</div>

See if this thread helps you any.  
[Mapping a tag output from 1000 input values - Ignition - Inductive Automation Forum](https://forum.inductiveautomation.com/t/mapping-a-tag-output-from-1000-input-values/46483)

---

<div class="post-metadata">

**Author:** ![byrcharl](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@byrcharl](https://forum.inductiveautomation.com/u/byrcharl)\
**Post date:** [March 2, 2022, 4:32pm UTC](https://forum.inductiveautomation.com/t/udt-tag-transform/56725/4 "2022-03-02T16:32:21Z")

</div>

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 .

 ![2022-03-02_8-30-38](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/7/472db2ab1b8afef6397230b3b9a20f42e81402cb.png)  
 ![2022-03-02_8-31-37](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/4/f4cfd54262df7e51acc9ec98367b85897e46a7d2.png)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 2, 2022, 4:39pm UTC](https://forum.inductiveautomation.com/t/udt-tag-transform/56725/5 "2022-03-02T16:39:53Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [March 2, 2022, 4:40pm UTC](https://forum.inductiveautomation.com/t/udt-tag-transform/56725/6 "2022-03-02T16:40:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [March 2, 2022, 5:17pm UTC](https://forum.inductiveautomation.com/t/udt-tag-transform/56725/7 "2022-03-02T17:17:48Z")

</div>

> [@byrcharl](#):
>
> I have a 2 column database that is holding the key and values.

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

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [March 2, 2022, 5:31pm UTC](https://forum.inductiveautomation.com/t/udt-tag-transform/56725/8 "2022-03-02T17:31:00Z")

</div>

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

```auto
return Event_Map.get_event(value)

```

---

<div class="post-metadata">

**Author:** ![byrcharl](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@byrcharl](https://forum.inductiveautomation.com/u/byrcharl)\
**Post date:** [March 2, 2022, 5:46pm UTC](https://forum.inductiveautomation.com/t/udt-tag-transform/56725/9 "2022-03-02T17:46:40Z")

</div>

sorry i said database i ment dictionary …

---

<div class="post-metadata">

**Author:** ![byrcharl](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@byrcharl](https://forum.inductiveautomation.com/u/byrcharl)\
**Post date:** [March 2, 2022, 5:47pm UTC](https://forum.inductiveautomation.com/t/udt-tag-transform/56725/10 "2022-03-02T17:47:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![byrcharl](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@byrcharl](https://forum.inductiveautomation.com/u/byrcharl)\
**Post date:** [March 2, 2022, 5:50pm UTC](https://forum.inductiveautomation.com/t/udt-tag-transform/56725/11 "2022-03-02T17:50:07Z")

</div>

Way cleaner thank you
