10-11-2018 09:35 AM
10-11-2018 09:37 AM
@rafael.assis16 wrote:
Hi, I'm new to labview. I have a string (Data1: A, Data2: B, Data3:C.......), I need to go through this string to fetch the data, regardless of the order. Example: look up Data2 and return only B. But I need to do this for a set of Data1 or Data2 and etc, my string will contain a lot of data.
From what the OP wrote, I'm not sure if all the "Keys" in the Key:Value pairs will be unique. i.e., it sounds like there could be multiple entries for Data1. So I was thinking how best to extract all the data for each unique Key. I'd seen a method that used variant data (apologies for not knowing the author). I modified it somewhat because the indexing tunnel forced the 2D array to have the maximum dimensions with the default being "0". IMO zero could be a valid value so I tried to force the default to be "NaN" instead. Looks kind of Rube Goldberg-ish.
Would this be the best/easiest method to sort the data?
10-11-2018 11:08 AM
My labview is 2012, do not open the file.
10-11-2018 11:20 AM
@rafael.assis16 wrote:
My labview is 2012, do not open the file.
Are you referring to my VI? If so, here it is in ver. 2012
10-11-2018 12:16 PM - edited 10-11-2018 12:17 PM
I liked your solution, but I have a problem because my data is strings and you do a string conversion for number. Another thing, I wanted to look for one or more values within that defined list, in this example it brings the result of all variables.
10-12-2018 08:42 AM
@rafael.assis16 wrote:
I liked your solution, but I have a problem because my data is strings and you do a string conversion for number. Another thing, I wanted to look for one or more values within that defined list, in this example it brings the result of all variables.
It sounds like the variant method is overkill for what you want to do. If it's just to extract all the values for a single key (like "Data 1"), it probably would be easier just to use a conditional tunnel. You can decide which method is better for your application.
I changed the indicators to be strings instead of DBL.
10-15-2018 06:50 AM
Thanks a lot for the help.