First occurrence of each item within list

I have a list of parameter names where numerous elements have the same parameter but the given number of elements various for each name varies. I want to take the list of elements and pair it down so I only have one element for each instance of the parameter name. How can I take the list of parameter names and create a true/false list for each time the name changes to use in a List.FilterByBoolMask for my element list?

For example, starting with the List.Sort I would want a corresponding list that reads as follows to use in my bool mask.
0 True
1 False
2 True
3 False
4 True
5 False
6 True
7 False
8 False
9 True

Try a List.GroupByKey node where the elements are the list and the key is the parameter value, followed by a List.Deconstruct node.

The GroupByKey node will our all elements with a common value together into sublists. Then the Deconstruct node will pop the first item out of each sublist (watch your list level and lacing).

The ‘first’ output from the deconstruct node would be elements which don’t need a new value, while the ‘rest’ are elements with a duplicate value. You can append unique suffixes onto the original parameter values or pull the last unique value and start numbering in sequence after flattening the list.


Thank you @jacob.small. I was using the list.groupbykey but not quite right. After reading your suggestion I changed how I was using that node and got to the solution I was wanting and with less steps. I appreciate the help!

1 Like