Create Condition that is dependant on the information, not index

Hello,
I’ve been trying to create an automated system where a specific information that is read from an instance parameter in revit can be replaced with a corresponding ID extracted from excel. I created a condition node saying that if the information has a specific name it has to be replaced with the corresponding ID. When I tried to replace it, in my name system, but it would’nt apply the condition on the actual information, but the index number.

Thanks for the help!


@gpjb37509 ,

you can use dictionary

KR

Andreas

Thank you for your suggestion, but I don’t want the ID (e.g., K01) to be changed to an index number because when I connect it to my string.replace node I get this warning (see picture). My goal is more to make the information of both lists dependant on each other, so that if dynamo reads e.g., architect in the naming it should automatically be replaced with the corresponding ID which would be K01.

@gpjb37509 ,

or you can make it by condion i did this by these 2 examples


grafik

KR

Andreas

This is solution Dictionary by Python

1 Like

Unfortunately, it didn’t work for me. It won’t generate the values.

Thank you so much. It worked

I now encountered a different problem with your script. I tried to change on of the parameters to see if the script would work if I updated something in revit. When then tried to run the python script it gave me an error message (see picture)

Please show your code inside that node.

I’d just use key/value pairing, then indexing:

If your list Key not contains in your dictionary, let’s add try-except to get value

Thank you, that helped me a lot also figuring out what my mistake in the information was. It’s not fully working.

1 Like