Change Element Parameter Based on Spreadsheet

For the life of me I have the hardest time working with lists in Dynamo. I cant shake the “If/Then” logic of standard programming.

I am stuck I have a spreadsheet with a bunch of old ID numbers and new ID numbers in column A and B respectively. This translates to a dynamo list with 2 levels. At the second level index 0 represents the old ID and index 1 represents to the new ID. I want to find the model element associated with the old ID number in my view and pass in the New ID number to that model element. I can index my model view and populate a list of element ID’s I just cant find a way to make the comparison and pass in the new ID to the correct model element.

Hi @lmanos ,

this looks like a good time to use a dictionary :


you can use it to get the new Id matching the old Id and feed it to the parameter.

@Mostafa_El_Ayoubi,
That seems to do what I need however it returns a list of 361 items where there are 1320 model elements and 136 rows or entries on the spreadsheet. Being that none of the lists line up how could I pass the correct return value from the dictionary to the Element.SetParameterByName?

Looks like some of the ids in your list don’t match the old ids list!

The hope is that the dynamo script matches the existing model elements with the spreadsheet data and updates the ID accordingly. I wonder if I could figure out a way to pass the Element ID into a list??

@lmanos
yeah I think I understood the goal but the problem is that some of the ID parameters in your revit file don’t have a match on the spreadsheet.

On another note, in your previous screenshot you’re feeding parameter values to the “element” input of the SetParameterByName node.