Cem_Cetin
(Cem Cetin)
November 5, 2025, 12:09am
1
Hello,
I’m trying to select the most recently added item from a list for each branch in my data tree.
My first thought was to use List Item with an index of -1. but the list is being sorted by value.
For example:
A branch in a tree contains the values [10, 20].
I then add a new item, the value 5, to this branch.
The list automatically sorts itself and becomes [5, 10, 20].
When I use List Item -1 to get the “last” item, it returns 20 (the highest value), but I want to get 5 (the item I just added).
How can I get the item that was chronologically added last for each branch, even if the list is being sorted by value?
Thanks!
Automatically? You mean when you use a sort component? If so, then you can maintain the list indices of the original list separately and use it to ‘unsort’ your sorted list when you require the queue order further downstream-
queue order.gh (14.6 KB)
1 Like
Cem_Cetin
(Cem Cetin)
November 5, 2025, 3:48pm
3
Thank you for this but the problem persists.
In here for example 0 is the last added item to the {2} branch but it still outputs 2.
Tom_Newsom
(Tom Newsom)
November 5, 2025, 5:27pm
4
Please upload your .gh file
No. Two is the last item “added” to the branch {2} list. If this is not the case, then sorting has already been done internally in the Python component.
Cem_Cetin
(Cem Cetin)
November 8, 2025, 1:13am
6
Yes the python component was sorting the values and I solved it within the python script somehow. Thank you!
You could also create all geometry with a timestamp and save it as Attribute user text