# Fault code matching to a list

**URL:** <https://forum.inductiveautomation.com/t/fault-code-matching-to-a-list/11674>\
**Category:** Ignition\
**Created:** [May 16, 2016, 8:01pm UTC](https://forum.inductiveautomation.com/t/fault-code-matching-to-a-list/11674 "2016-05-16T20:01:45Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr.K001](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Mr.K001](https://forum.inductiveautomation.com/u/Mr.K001)\
**Post date:** [May 16, 2016, 8:01pm UTC](https://forum.inductiveautomation.com/t/fault-code-matching-to-a-list/11674/1 "2016-05-16T20:01:45Z")

</div>

Hey guys, I want to ask for your opinion on this issue,  
I have a list of 1200 fault integers and their fault detail(usually nothing more than 20-30 characters each). I get the fault integer as a tag from the PLC and I can display it just fine BUT i’m trying to figure out the best way to match that integer to my list and display what fault that integer refers to.  
Should I try to read from the excel file and match the integer to a cell and grab the corresponding cell or should I insert that list into a DB table and use a query to find what the fault string is? Is it there any other options that I haven’t looked at that might come handy?  
This list of 1200 faults is only for one Press line and there are 6 more so I want to find the best way to tackle this issue since I will have to do the same for the other 6 lines. Thanks in advance for your ideas.

```
          Kam,
```

---

<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:** [May 16, 2016, 8:36pm UTC](https://forum.inductiveautomation.com/t/fault-code-matching-to-a-list/11674/2 "2016-05-16T20:36:49Z")

</div>

If the list rarely changes (new line, etc), I would put it into a database table with a column indicating what line it belongs to. Then use a non-polling SQL query in a client tag to read that table for a line at client startup. Then use lookup() expressions to pick out the text for display.

---

<div class="post-metadata">

**Author:** ![Mr.K001](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Mr.K001](https://forum.inductiveautomation.com/u/Mr.K001)\
**Post date:** [May 16, 2016, 8:46pm UTC](https://forum.inductiveautomation.com/t/fault-code-matching-to-a-list/11674/3 "2016-05-16T20:46:24Z")

</div>

As far as I know the list shouldn’t change but I’m not 100% sure. I was so hoping not to have to put all that 1200 of them in an SQL insert code 😛

---

<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:** [May 16, 2016, 8:48pm UTC](https://forum.inductiveautomation.com/t/fault-code-matching-to-a-list/11674/4 "2016-05-16T20:48:52Z")

</div>

In MSSQL, you can copy/paste from excel into SQL Server Management Studio. [Stackoverflow thread](http://stackoverflow.com/questions/316978/paste-ms-excel-data-to-sql-server)

In MySQL, there is an Excel Add-in called: [MySQL for Excel](http://www.mysql.com/why-mysql/windows/excel/)

---

<div class="post-metadata">

**Author:** ![Mr.K001](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Mr.K001](https://forum.inductiveautomation.com/u/Mr.K001)\
**Post date:** [May 16, 2016, 8:51pm UTC](https://forum.inductiveautomation.com/t/fault-code-matching-to-a-list/11674/5 "2016-05-16T20:51:10Z")

</div>

Hell yeah! that will make my life soooo much easier 😛 Thanks for the suggestion.

---

<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:** [May 16, 2016, 8:51pm UTC](https://forum.inductiveautomation.com/t/fault-code-matching-to-a-list/11674/6 "2016-05-16T20:51:45Z")

</div>

Sorry, had to revise my link above to actually make it work… 😒

---

<div class="post-metadata">

**Author:** ![Mr.K001](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Mr.K001](https://forum.inductiveautomation.com/u/Mr.K001)\
**Post date:** [May 20, 2016, 3:01pm UTC](https://forum.inductiveautomation.com/t/fault-code-matching-to-a-list/11674/7 "2016-05-20T15:01:55Z")

</div>

Hey guys, I figured I add this here since it’s kinda about the same subject. So I have a folder full of Boolean bits, now these are technically the same faults as the excel list but I’m trying a different approach. so there are 7 cells and each have a folder that has all these bits as you can see below, now I trying to think of a way of going through each folder and say three tags Boolean are true, I want to grab all 3 names and display them, I’ve been trying to think of ways of doing it in the designer without actually scripting but I’m running out of ideas and feel like scripting is the only way, any ideas?  
with expression and logic statements I can only check on tag at a time and I need to check them all so I feel like scripting is the better way since I have use loops to have it go through all the tags and grab that name of any tags that are true, am I on the correct path or do you all have better ideas I can try?

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [May 20, 2016, 8:51pm UTC](https://forum.inductiveautomation.com/t/fault-code-matching-to-a-list/11674/8 "2016-05-20T20:51:41Z")

</div>

If they are all the same, I would create a template with all of the tags in it.  
Use indirect addressing to set the folder part of the tag path, then set the visibility of each Label in the template based on the Boolean tag value.

---

<div class="post-metadata">

**Author:** ![Mr.K001](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Mr.K001](https://forum.inductiveautomation.com/u/Mr.K001)\
**Post date:** [June 8, 2016, 5:12pm UTC](https://forum.inductiveautomation.com/t/fault-code-matching-to-a-list/11674/9 "2016-06-08T17:12:00Z")

</div>

[quote=“MMaynardUSG”]If they are all the same, I would create a template with all of the tags in it.  
Use indirect addressing to set the folder part of the tag path, then set the visibility of each Label in the template based on the Boolean tag value.[/quote]  
Thanks for the suggestion, my issue is I have table that shows the fault integers and I want to be able to show what that fault code means, I talked to IT and they are working on importing the fault codes/descriptions to a table on the DB. That would probably be the easiest since there are 1200+ fault codes.

---

<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:** [November 19, 2021, 8:29pm UTC](https://forum.inductiveautomation.com/t/fault-code-matching-to-a-list/11674/10 "2021-11-19T20:29:43Z")

</div>

In case anyone does this

I used a dictionary which I made in excel, then placed in a script.

The dictionary is in my project scripts, but on one machine I have the dictionary inside the script that uses it.
