How to add an item to end of sublist if sublist above is bigger then 1

Hi everyone,

Today i got stuck on the following list-logic:

I want to add an item to a sublist if the sublist above is bigger then 1.

The count and Boolean tell me if the list applies to this condition. I then want to apply the node function ‘add item to last’ if this is true.

Adding the ‘item’ based on the true condition worked in design script, only the false condition does not return the original list.

Maybe I am thinking too difficult, since I only ‘want to apply function if true’ else ‘do nothing’

Hope you can help,

Kind regards,

Martin

@MartinVrielink ,

you can start from here… …prefilter, after that add your item

When you say “the sublist above” do you mean the previous sublist or the list level above the sublist (the list containing the sublist)?

Either way, the issue here is that you can’t add “nothing” to the end of a list with those nodes. The best option would be to use python, but if you want to stick to nodes you can do the following: have your if statement return whatever it is you need when the list length is greater than 1, otherwise have it return a specific string that you can later filter out. It means one more step of removing some of the items you just added, but it’s easy to do and simple to follow.

1 Like

Hi there.
Are you trying to do this?

Cheers
Manel

2 Likes

Thank you all for the suggentions,
I will give it a try.

Kind regards,
Martin