# List.ReplaceItemAtIndex - multiple indeces in same list

**URL:** <https://forum.dynamobim.com/t/list-replaceitematindex-multiple-indeces-in-same-list/13483>\
**Category:** Lists-Logic\
**Tags:** dynamo\
**Created:** [July 27, 2017, 3:32am UTC](https://forum.dynamobim.com/t/list-replaceitematindex-multiple-indeces-in-same-list/13483 "2017-07-27T03:32:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyle\_Martin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kyle_martin/32/15927_2.png) [@Kyle\_Martin](https://forum.dynamobim.com/u/Kyle_Martin)\
**Post date:** [July 27, 2017, 3:32am UTC](https://forum.dynamobim.com/t/list-replaceitematindex-multiple-indeces-in-same-list/13483/1 "2017-07-27T03:32:18Z")

</div>

Struggling with the List.ReplaceItemAtIndex node… is it possible to replace more than one index with a matching amount of nested lists in the _same_ list? To make things more complicated, I would like to do this across multiple lists – likely using the ListAtLevel feature to pair structures.

I also tried the List.ReplaceItemAtIndex+ node from Clockwork but no luck…

 ![20170726_DynamoForum_List-ReplaceItemAtIndex](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/9/7972dc6623578a40021bf12e14b9344494436bf8.png)

[20170726\_DynamoForum\_List-ReplaceItemAtIndex.dyn](https://forum.dynamobim.com/uploads/short-url/sywqQlZlUcBOFJYFKw9OZVrhNcu.dyn) (13.2 KB)

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [July 27, 2017, 3:58am UTC](https://forum.dynamobim.com/t/list-replaceitematindex-multiple-indeces-in-same-list/13483/2 "2017-07-27T03:58:20Z")

</div>

I have a thought but it’s midnight and I’m out of the office. I’ll try to vocalize/test it in the morning.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [July 27, 2017, 1:43pm UTC](https://forum.dynamobim.com/t/list-replaceitematindex-multiple-indeces-in-same-list/13483/3 "2017-07-27T13:43:37Z")

</div>

@Kyle_Martin how are you getting the indexes to replace with the new list? Is there an index of node or other test earlier in your graph?

---

<div class="post-metadata">

**Author:** ![Kyle\_Martin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kyle_martin/32/15927_2.png) [@Kyle\_Martin](https://forum.dynamobim.com/u/Kyle_Martin)\
**Post date:** [July 27, 2017, 2:11pm UTC](https://forum.dynamobim.com/t/list-replaceitematindex-multiple-indeces-in-same-list/13483/4 "2017-07-27T14:11:17Z")

</div>

My overall goal is to take values in the “originalList” and replace some of them them with a pair of sub-values that still add up to the original number. That way both the original list and new list still have same overall sum, the only difference being the count of items within each list.

The image below is from context. The values in List.Transpose contain the calculated replacement sub-values and List.Reverse contains the indeces from earlier steps:

 ![20170727_DynamoForum_List-ReplaceItemAtIndex2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/3/13b748eba9f9ad98e2100b4bf2bf4b75cd712217.png)

---

<div class="post-metadata">

**Author:** ![Giovanni\_Brogiolo](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@Giovanni\_Brogiolo](https://forum.dynamobim.com/u/Giovanni_Brogiolo)\
**Post date:** [July 27, 2017, 2:53pm UTC](https://forum.dynamobim.com/t/list-replaceitematindex-multiple-indeces-in-same-list/13483/5 "2017-07-27T14:53:17Z")

</div>

Hi Kyle,

Please have a look at this:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/c/7cf61b13dcae54ed7ad4c71d87daed7444264790.png)

I still can’t find a way to not use the ReplaceItemAtIndex twice.

In this case I think it could be worth looking at Python too.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/2/62aeae849b9f06c323f276ac15611ec4f313891f.png)

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [July 27, 2017, 3:51pm UTC](https://forum.dynamobim.com/t/list-replaceitematindex-multiple-indeces-in-same-list/13483/6 "2017-07-27T15:51:36Z")

</div>

Tougher than I’d thought - merging the lists based on length might work but I’m locked up and getting distracted too much. I’ll try again tonight.

---

<div class="post-metadata">

**Author:** ![peter.knight](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/peter.knight/32/44592_2.png) [@peter.knight](https://forum.dynamobim.com/u/peter.knight)\
**Post date:** [March 29, 2018, 5:15am UTC](https://forum.dynamobim.com/t/list-replaceitematindex-multiple-indeces-in-same-list/13483/7 "2018-03-29T05:15:39Z")

</div>

Hi All,  
I’m struggling with something pretty similar… Thanks to all for previous posts that got me this far!

I have a list of sub lists, some of which I wish to replace (with a " " in the final version). I can’t get List.ReplaceItemAtIndex to treat the sublists based on the sublists fed to it. Any thoughts?  
Many thanks!

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/7/27e8977bf28549fa25cc733c3fa670ca1307c5d6.PNG)[Replace Item.dyn](https://forum.dynamobim.com/uploads/short-url/AjqmZfCsN7ZXwQH4NJSlZc0t0G9.dyn) (8.9 KB)

---

<div class="post-metadata">

**Author:** ![kennyb6](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kennyb6](https://forum.dynamobim.com/u/kennyb6)\
**Post date:** [March 29, 2018, 6:06am UTC](https://forum.dynamobim.com/t/list-replaceitematindex-multiple-indeces-in-same-list/13483/8 "2018-03-29T06:06:38Z")

</div>

Can you recreate this post as a new topic and link to this thread? It helps to keep things organized and solutions matching.
