Forum

Compare multiple strings (spreads)

I guess this is simple, but I got a bit lost…
There is an input slice with string-numbers that should be compared to string-numbers in a spread with multiple slices. The result should be a spread that shows the matches.

As I had to separate the strings in order to compare it, the original index numbers got lost. How to re-arrange the spread in order to get back the original Index?

Attached a patch that illustrates the problem. Thanks for any help!

compare1.v4p (15.1 kB)

First thing
Separate (String)'s Former Index returns the index of the input slice to which the output slice formerly belonged.

Second thing
You can use “normal” Select (Value) if you need this kind of logic.

Third thing
You’re probably looking for Sift (Value).

Fourth thing
I made a patch. Or modified yours.

In the end, all depends on how you want to get your results (sift way VS. count > select > equals way).

Hope this helps.

compare1_mod.v4p (29.5 kB)

Still struggling to get the results re-arranged according to their original spread ID’s.

Actually, the Sift (string) node would probably do the job, but it compares every single letter, not taking into account “words” divided by spaces or commas. The problem is that it compares “1” to “11” and returns two hits for “1”.

When separating the string, it is possible to compare all values prober. But at the same time, the original spread IDs get lost. So the main question is: How can I make use of the “Former Index” output pin of the Separate Node to arrange the separated matching results according to their original slice order?

Sift (String) should not work like that - or I misunderstood your description?
Anyway, if you open its helppatch, does it found the match? Here, with 33.3_x86 seems to work fine.

The index stuff is solved in the patch down here?

compare1_mod_2.v4p (7.6 kB)

Attached a screenshot that illustrates why Sift (string) is not suitable for comparing numbers that are higher than 9.

I basically need the results arranged according to its original index. Based on the example patch, the result should have two slices that are indicating the matches in the first and second slice (or more, in case there are more input slices). How to make use of the “Separate” “former slice” output pin to re-arrange the results back to the original index slices? Attached a screenshot with comments.

… no text …

compare1_mod_3.v4p (16.2 kB)

Yeah! Works perfect now.
Thanks a lot!