# UDT Expression Tag Dictionary

**URL:** <https://forum.inductiveautomation.com/t/udt-expression-tag-dictionary/55728>\
**Category:** Ignition\
**Created:** [February 3, 2022, 7:08pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-dictionary/55728 "2022-02-03T19:08:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexavier\_Garcia](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@Alexavier\_Garcia](https://forum.inductiveautomation.com/u/Alexavier_Garcia)\
**Post date:** [February 3, 2022, 7:08pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-dictionary/55728/1 "2022-02-03T19:08:23Z")

</div>

Im trying to get the `Fault1Description` expression tag to return a string message based on the value of `Fault1Code` but only when `Faulted` is True. I want this string to show up on the display path of the `Faulted` bit’s Alarm.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/e/ee3a0bf4106544475438a267b9eca9eb853aeed4.png)

I created a dictionary with all the possible VFD fault codes & brief description as key-value pairs. Test ran the code in the script console and it worked.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/2/32617dfb95a67e8bcefdedb53b57cd49d762a34b.png)

I then copied & pasted the code into `Fault1Description>Expression` and modified it to look like this:

```auto
Fault1CodeDict = {0 : ' -- F000 - No Fault',
2 : ' -- F002 - Auxiliary Input',
3 : ' -- F003 - Power Loss',
4 : ' -- F004 - UnderVoltage',
5 : ' -- F005 - OverVoltage',
6 : ' -- F006 - Motor Stalled',
7 : ' -- F007 - Motor Overload',
8 : ' -- F008 - Heatsink OvrTmp',
9 : ' -- F009 - CC OvrTmp',
12 : ' -- F012 - HW OverCurrent',
13 : ' -- F013 - Ground Fault',
15 : ' -- F015 - Load Loss',
21 : ' -- F021 - Output Ph Loss',
29 : ' -- F029 - Analog In Loss',
33 : ' -- F033 - Auto Rstrt Tries',
38 : ' -- F038 - Phase U to Gnd',
39 : ' -- F039 - Phase V to Gnd',
40 : ' -- F040 - Phase W to Gnd',
41 : ' -- F041 - Phase UV Short',
42 : ' -- F042 - Phase UW Short',
43 : ' -- F043 - Phase VW Short',
48 : ' -- F048 - Params Defaulted',
59 : ' -- F059 - Safety Open',
63 : ' -- F063 - SW OverCurrent',
64 : ' -- F064 - Drive Overload',
70 : ' -- F070 - Power Unit',
71 : ' -- F071 - DSI Net Loss',
72 : ' -- F072 - Opt Net Loss',
73 : ' -- F073 - EN Net Loss',
80 : ' -- F080 - Autotune Failure',
81 : ' -- F081 - DSI Comm Loss',
82 : ' -- F082 - Opt Comm Loss',
83 : ' -- F083 - EN Comm Loss',
91 : ' -- F091 - Encoder Loss',
94 : ' -- F094 - Function Loss',
100	: ' -- F100 - Parameter Chksum',
101	: ' -- F101 - External Storage',
105	: ' -- F105 - C Connect Er',
106	: ' -- F106 - Incompat C-P',
107	: ' -- F107 - Replaced C-P',
109	: ' -- F109 - Mismatch C-P',
110	: ' -- F110 - Keypad Membrane',
111	: ' -- F111 - Safety Hardware',
114	: ' -- F114 - Microprocessor Failure',
122	: ' -- F122 - IO Board Failure',
125	: ' -- F125 - Flash Update Req',
126	: ' -- F126 - NonRecoverablErr',
127	: ' -- F127 - DSIFlashUpdatReq',}

print (Fault1CodeDict[{[.]Fault1Code}])

```

When I go in the Tag Browser and open up the ConvVFD instances I see this:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/f/bf6a3b3761350a08405ab1f3940c69d58727a781.png)

When I hold the cursor over the red X, it says “error configuration”.

Also, what would be the proper way to add this string to the existing display path? This is what it looks like at the moment:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/9/790830acdd4c8340f1b92b94505f79325fae1708.png)

```auto
{Area} + " " +{ConveyorNumber} +" VFD Fault (" + {VFDNumber} + ")"

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 3, 2022, 7:12pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-dictionary/55728/2 "2022-02-03T19:12:38Z")

</div>

Dictionaries are python/jython, as is the script console. Expression tags need functions and operators from Ignition’s expression language. That isn’t jython at all.

Consider creating a dataset memory tag with the contents of your dictionary in two columns. Then the expression language’s `lookup()` function can pick the string as the fault code changes.

---

<div class="post-metadata">

**Author:** ![Alexavier\_Garcia](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@Alexavier\_Garcia](https://forum.inductiveautomation.com/u/Alexavier_Garcia)\
**Post date:** [February 3, 2022, 8:45pm UTC](https://forum.inductiveautomation.com/t/udt-expression-tag-dictionary/55728/3 "2022-02-03T20:45:00Z")

</div>

Thank you!!
