Replace Item in a sublist at Index


I found another posts almost like this… but i still fighting whit this!

(in the first image, all subslists are TRUE AND FALSE, except what i mencioned above, but i’ts not always like this, somethimes i have FALSE AND TRUE, but for me i don’t care. my big problem here is that i CAN’T have TRUE and TRUE.)

Change your replacement item from just false to {true,false}. Your graph is working, you’re just not supplying the right list.

dont… i tried this before… look image below… it created 945 itens kkkk 106 * 9

Ah ok. So your problem is that ReplaceItemAtIndex doesn’t replace items simultaneously. If you look at the output, it replaces each index separately, giving you 9 lists instead of one.

EDIT: This issue comes up every once in a while but I honestly don’t remember if there’s a good solution for it besides Python. (That’s how I usually get around it.)


Here’s a quick and easy way to get around it.

dataEnteringNode = IN
list = IN[0]
bools = IN[1]
replace = IN[2]
output = []

for a,b in zip(list,bools):
	if b == True:

OUT = output

Thank you Nick!

So you’re saying you want to get a single item back, but the lists with two true values returns both items. You can use IndexOf to get the index of the first matching item. It’ll give you a null value if there are none in the list but that should be fine.

You could also use FirstItem to get the first item of each sublist when the mask returns multiple items.