03-12-2017 03:16 PM
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
03-12-2017 05:07 PM
@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
03-12-2017 06:16 PM
Search the first column for a match. Use the index found for the match to get the entire row.
03-13-2017 03:32 AM
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
03-13-2017 03:35 AM
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.
03-13-2017 03:40 AM
03-13-2017 03:44 AM
03-13-2017 04:53 AM
Thanks everyone I think I got it, please check though?
Will this work, if the table is being updatedevery 200 mseconds?
03-13-2017 06:24 AM - edited 03-13-2017 06:25 AM
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.
03-13-2017 07:38 AM
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?