Group by Function First Item

Hello, I’m trying to understand why Grouping by Function sometimes places the sub-list on top (FirstÍtem) and sometimes places the sub-list on the bottom (LastItem or Rest of Items). It would be nice to have a consistent outcome. Thanks

Try List Level

1 Like

Hi Nico, I’m not sure I totally follow what you’re saying. My concern is that depending on the service I choose (highlighted in yellow), the sub-list is placed either on top or bottom. In reality after making the change you suggested all is fine except for index 0, where the list flip-flops. If there is a different way to manage my list I’d like to hear about. Thanks

what happens when you write 0 into youre code block? Which one goes into the node list.getitemattIndex
0 = the first item off a list not 1

If I write 0, then the List work as supposed only for the service at index 0. Either way, one of the values always make the sub-list go to the bottom or top of the list.

show a bigger part of the graph

In my experience, the list.groupby____ nodes group things acroding to the order they are found, so it a ‘true’ value is the first result of your function then it will return the trues before the false, but if a false value is the first result then your false values will be returned first. Since you don’t know the results of the function in various forms, you cant use get item at index to reliably get consistent results.

You might be better off getting the values and grouping the list by the parameter value, and iterating over the list acordingly, or use the == node on the keys to create a Boolean to filter the various groups by.

Using a Boolean helped solving the problem. I’m getting consistent results now. Thanks for all the help

1 Like

No problem. If something solves an issue please mark it as a solution so that future users who are struggling with the same thing can find it quickly in the future.