Showing results for 
Search instead for 
Did you mean: 

Build and search a text array error log problem

Go to solution

I have a serial controlled instrument that I can query for a status and error code.  There are maybe 10 possible error codes to look for.  I can parse the instrument text string using string subset to get the error code letter/symbol from the return string.  I created a text array and a used search 1D array to match the error library in the array.  The problem is the search array doesn't match the error code correctly for all searches.  In trying to figure it out I created a test VI to troubleshoot the problem without needing the instrument,  see attached.  The search seems to work for every array element except for element 4, "g".  I can't figure out the reason it doesn't match a search for the letter "g". 


I have two questions: first is this approach of building a error code table as a text array, then searching the array for a match a good way to go? Or is there a better approach to converting the instrument error string into a user alert error code?


Second, What did I do wrong where the array search for "g" doesn't match?

0 Kudos
Message 1 of 5
Accepted by topic author dannyjhu


Remove 0I below 'g' and everything will run fine. 

0 Kudos
Message 2 of 5
Accepted by topic author dannyjhu

It's not a simple g. Right-click on any array element and select '\' Codes Display to view the real string.

Alternatively, expand the element vertically.

LV 7.1, 2011, 2017, 2019
0 Kudos
Message 3 of 5

Thanks for the help.  I didn't think to expand the cell or display the \code.  Feeling a little stupid now.  

0 Kudos
Message 4 of 5



       These are the basics "Search element in an array". If its returning "-1" either there's no element or its your case.

0 Kudos
Message 5 of 5