Delete last items counted from the back, based on a number



Tree A: consists of multiple branches with multiple items.
Tree B: consists of the same ‘branch Names’ all containing 1 value.

I would like to delete 1/or more items counted from the back.
So if there is a 1 --> delete the last item in that branch
If there is a 2 --> delete the last 2 items in that branch
In a generic way.

2020-12-14 Delete items counted from the back based on (22.8 KB)

Any suggestions?


I am pretty sure you can reverse the list and then use the numbers to split the list accordingly. Then of course make sure to reverse the list again

1 Like

How about Shift List with ‘W’ (Wrap) false (inverted) and a negative value for the ‘S’ input?

I have @ruud.vanknippenberg on ignore so can’t see the original question, only the title.

1 Like

You can also set those index numbers to negative and it should count back from the last index. So, -1 is the last item in the list and -2 is the second to last item.

It appears that my solution does not work with the split component. However, if you use list length and subtract the index numbers, you can use those as the index split the list and remove them.

1 Like (9.2 KB)

The expression on Shift List ‘S’ input is “-x”.

Thank you! :+1: :+1: