Filter list with unique based upon other list

So.

a list of generic models
[element 1, element 2, element 3]

getting the parameter ‘comments’ of each
[a, a, b]

Now I want my Generic Model list to be reduced with only unique comment values.
So
[element 1, element 3]
(yes, element 1 could be element 2, that wouldn’t matter to me).

what would be the best approach?

Hi @3Pinter,

Try using UniqueItems Node.

List.UniqueItems on the parameter values
List.IndexOf for the unique items output and the parameters values
List.GetItemAtIndex for the elements using the resulting index list from the index of node.

1 Like

@cescobido,uniqueitems I use when getting the unique values of the comments.So that one I already use.

@jacob.small, good suggestions. It seemed to me that List.IndexOf didn’t do the thing I wanted to achieve. Nevertheless your suggestion made me think about List.FirstIndexOf; which does work nicely.

Thanks.

Hi @3Pinter,

This might do the trick.

The last Node (List.GetItemAtIndex), the list should contain the actual element and not text (value.)

Cheers.

1 Like

That’s very nice. I’ve added it to my useful scripts but using levels now rather than list map.