04-01-2019 02:20 PM
Hello,
I would like to extract the rows from the "Input Array" based on the "Search Array" and given "Column Index".
In the example given, a new array given by rows 1 and 2, extracted from the "Input Array", will be the desired match. Therefore, the output array will be 2 rows given by Row 1 and Row 2 of the "Input Array".
Any help to get started on this is sincerely appreciated!
Thanks,
hiNi.
Solved! Go to Solution.
04-01-2019 02:55 PM
See if this works for you. (there are a few other ways to do it of course)
(In the more general case, you might want to trim whitespace and do other cleanup, etc.)
04-01-2019 03:05 PM
Of course the above "solution does not scale well, because it would need to be rewritten if the number of matched columns is different from 3. It also assumes that the input is correct, e.g. that the two lower arrays have the same size. To guarantee equal size, I would probably use an array of clusters for the secondary inputs, where each cluster contains an index and string, for example.
04-01-2019 03:06 PM - edited 04-01-2019 03:09 PM
Hello,
I love the simplicity of your solution. If the "Column Index" array size is changed from 3 to 5, I will have to manually change the index array size in your solution. Is there a more dynamic solution possible given the requirement of automatically updating the index for scaleability? The lower arrays are given to always be the same size. Thanks again!
04-01-2019 03:33 PM
You could do something as follows:
(or just autoindex on both your arrays (no clusters) on the onner FOR loop and the shorter one wins)
05-02-2021 01:59 PM
Hi altenbach
It works very well. I been trying to add a new term, using "in range and coerce" , but nothing has worked so far.
Can you please give me a hand? I{ll really appreciate it. Thank you!
05-03-2021 05:24 AM
I am not sure why "term 1" is an array, but if you want to filter out rows that match term 1 AND term 2, just do e.g. as follows:
First term check if the element in the first column is "1" and the second term checks if the element in the second column is in range.
You might want to specify which columns should be checked for term 2. You could add another index control (not shown).
(Next time when you attach a VI, please make sure all controls have typical default data so we can test.)