LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting data from a string table

Hello:

I have a table of strings that gets filled up in real time. The First column gives me it's ID and the second one it's info. If I wanted to extract the info of a certain ID (and display it or store it for further use) how can I proceed to do it.

I need help

 

Regards

0 Kudos
Message 1 of 11
(4,085 Views)

@LP_C wrote:

Hello:

I have a table of strings that gets filled up in real time. The First column gives me it's ID and the second one it's info. If I wanted to extract the info of a certain ID (and display it or store it for further use) how can I proceed to do it.


You describe a "table" that has two "columns", ID and Info.  You also suggest that it "gets filled in real time" (whatever that means).  Makes me think that you are adding "rows" of data consisting of a pair of strings, ID and Info, every so often (I'm being vague because I'm working with the vague information you have provided).

 

There are many ways to arrange string data that will fit the above vague description.  I'm guessing that you know almost nothing about LabVIEW, so I'll keep this a little abstract.

 

What sort of data structure keeps turning up in computing that can be characterized as "having many rows and two columns"?  How about a 2-D Array (of strings, since that's the data type you describe).  

 

Have you spent any time with the LabVIEW Tutorials?  You can find links to them on these Forums, or by searching the Web.  Arrays are pretty basic.  If you have an ID string and an Info string, you can "stick them together" using Build Array to make a 1-D Row, then can "stick" that on your Table of rows to build a new Table with one more row.

 

So if I gave you such a Table and said "What is the Info in the Row with ID "My Favorite Row"", what would you do?  [I'm not going to answer this one -- I'm confident you can come up with a suitable algorithm].  Incidentally, there are books written about this general topic, but I'm guessing your table will be relatively small (a few hundred entries, at most), so almost any algorithm will do, as long as it works!.  [As an exercise for the Reader, think about how you would prove that your algorithm would always return the correct value].

 

Now it's your turn.  Learn a little LabVIEW, write yourself a little VI to (a) generate some data, (b) organize the data into a Table, (c) ask the User for an ID, and (d) return the Info from the Table that "matches" that ID.  If you get it right, you might return here and say "Thank you, I was able to learn enough LabVIEW to do this problem".  If you get stuck, come back here, explain the problem you are having, and attach your VI so we can see (a) what you've done, (b) what you know (or don't know), and (c) what mistakes you've made.  We can then suggest ways for you to learn how to solve your own problems.

 

Bob Schor

0 Kudos
Message 2 of 11
(4,065 Views)

Search the first column for a match.  Use the index found for the match to get the entire row.

0 Kudos
Message 3 of 11
(4,051 Views)

For Example on the VI Attached, I want the info for ID PKI8, so if I write PKI8 I want  the info display to show me the string on the info column of the same line of the ID

 

0 Kudos
Message 4 of 11
(4,029 Views)

I have no Idea how to do that....


natasftw escribió:

Search the first column for a match.  Use the index found for the match to get the entire row.


 

0 Kudos
Message 5 of 11
(4,028 Views)

Hi LP,

 

I have no Idea how to do that…

- index the first column

- search this column (aka 1DArray) using Search1DArray

- use the resulting index to index the corresponding row from your 2DArray…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 11
(4,023 Views)
Use Index Array by using Row/Column.
-In your case column-0
-Then use search 1d Array to get the index where it is matching.
-Then use Index Array Column and use the Column as 2 and the row from Search 1D array.
Thanks
uday
Message 7 of 11
(4,022 Views)

Thanks everyone I think I got it, please check though?

Will this work, if the table is being updatedevery 200 mseconds?

0 Kudos
Message 8 of 11
(4,016 Views)

Here is a simplified version of your VI.

 

I recommend you keep the table data in a shift register.  Then when you call this VI, it just uses whatever was last saved in the shift register.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 11
(4,005 Views)

crossrulz escribió:

Here is a simplified version of your VI.

 

I recommend you keep the table data in a shift register.  Then when you call this VI, it just uses whatever was last saved in the shift register.


How do you use a shift register?

0 Kudos
Message 10 of 11
(3,997 Views)