Replace item at index

Hello,

I’m having an issue working with lists. I’m trying to replace a value given an index. However I’m not sure why, but it doesn’t seem to be behaving like I expected. I’ve tried changing the lacing to no avail. I’ve attached some snaps of the definition, the definition file and the Revit file.

Basic Test 1.rvt (12 KB)
Sound_Params_V1.dyn (12.7 KB)

I would appreciate whether you think this is a good way of solving the problem as well, I’ve seen lot’s of topics to do with list logic in this field and I could do with knowing a good way of solving this. Some of the posts I’ve been looking at today are as follows.

[What if you have more than 1 if statement?]

https://forum.dynamobim.com/t/replace-items-in-sub-lists/10391

https://forum.dynamobim.com/t/replace-by-condition-list-and-sublist/16568/5

https://forum.dynamobim.com/t/replace-by-condition-list-and-sublist/16568/3

https://forum.dynamobim.com/t/replace-by-condition-with-any-list-structure/19560/2

https://forum.dynamobim.com/t/list-replaceitematindex/4694/5

Hello,

What is the outcome of this task?

Hey,

I’m going to write those numbers (13,5,9 for example) back into a room parameter later down the line. That later section I know how to do.

I’ve also noticed I was missing a item for index 3. That is now sorted.

no%20data%20m8

So if I understand correctly, wherever you see a 3 for instance in your list flatten that you tie into “index” you want it to return a “nah m8” or some value you specify correct?

1 Like

Tell me if I am understanding this right:
The list of parameter values at the top, you want it changed to either 13, 5, 9, or “nah m8” based on the flattened list in the same index?

If that is true, is there any need for using the parameter value list as an input? Can’t you just replace what is in the flatten list with the 13, 5, 9, etc and use that instead? Isn’t it the same thing?

1 Like

Yes that is correct.
I didn’t need to use that parameter value list. I thought I would have to give it a sequence 7 long to feed into that node.

I understand there will be a few different ways of doing it, and would like to know ones that reduce computing power required.

Thanks for your reply.

This is what I wanted thank you. I’ve only just seen your other two solutions but I think this one looks to be simpler to set up.

I think it’s about time I started learning python.

Sorry about the Revit file not working…
Tusen takk.

replaceitematindex

Would this work?

2 Likes

That worked as well thank you.