Nested list replace items problem

Hi all,

I have two lists with a complex structure, one of these contains indices of items i want to replace in the other.

A screenshot of parts of these lists is below, with my haphazard scribbling over the top. What I want to do is replace the items of the second list at the indices given in the first list just with a simple ‘X’. I’m sure this should be easy to do with the ReplaceItemAtIndex node but after some time experimenting with this I can’t work out a solution. I’m hoping someone out there with more experience at list management may be able to help me!

Many thanks in advance
image

Hey there,

For this task, I recommend using “Replace item at index” with lacing set to "Longest.

Maybe this was part of your testing if not you can give it a try.

Otherwise, I see you have four levels for your list so you might need to use the list levels option (as shown in the attached file).

This is my first idea, let me know wether this is the answer you needed.

Cheers,

List level

1 Like

Hi Ikichenin,

Thanks for your reply. I tried it out and experimented with different kinds of lacing at different list levels and still haven’t been able to find quite the solution I’m look for.

The screenshot below shows what lacing at longest and with the list levels set. This kind of creates a new list for each index so only one index is replaced in each list, but what i’m looking for is the structure of the list on the left to be preserved to give the solution below:

| | 0 list
| | | 0 X
| | | 1 X
| | | 2 ’
| | | 3 ’
| | | 4 ’
| | | 5 ’
| | 1 list
| | | 0 X
| | | 1 X
| | | 2 ’
| | | 3 ’
| | | 4 ’
| | | 5 ’
| | 2 list
| | | 0 X
| | | 1 X
| | | 2 X
| | | 3 X
| | | 4 ’
| | | 5 ’
| | 3 list
| | | 0 X
| | | 1 ’
| | | 2 X
| | | 3 X
| | | 4 X
| | | 5 ’

A link to a test file is below if this helps things

Test.dyn (12.4 KB)

Use List.ReplaceItemAtIndex from Clockwork instead. It works for lists.

1 Like

Amazing! Thank you