Match Excel Room Number to Parameter Room Number

I have an uneven list of room numbers from a Revit file and an excel file. I need to set parameters from the excel list to the rooms in revit. (Need to add name of person in room and there phone extension) How can i reorder my list so i can set the parameters to the rooms in revit.
Thanks for any help ahead of time!

Attempt 1:


Attempt 2:

Any mismatches (for instance, if the excel file is missing room numbers) turn up as null. Any matches are re-ordered to match the Revit element list.

Now that the list ordering is organized, you can extract the sublist data and feed as appropriate into your parameter setting sections.

1 Like

Robert, So it only found 2 matches. What am i doing wrong?

Not positive as the watchlists are for the most part out of range of one another (I spotted one match?)
Can you confirm how many matches are supposed to be there? Use a list.sort on both to visually check.

It may have something to do with the storage type. Try converting both lists to string objects before making the comparison.

1 Like

That worked!! Thank you!!

Final Image:

Hi,
Another idea is to use Dictionaries to create a Dictionary of Room elements as values, and their Unique Numbers as keys.
Them you can easily find the corresponding Room elements using the node ValueAtKey.
I use this workflow in all my Room related scripts.
Good luck

1 Like

Hi @a.halim ,

Could you exemplify a simple script based on what you have mentioned?
I am kindy new to Dynamo and I am trying to do something similiar: making room numbers by order of theirs unique id, but if some existing rooms being deleted in future I still want to keep the exact same numbers for the remaining ones.

Any input would be apreciated.
Best,
Pedro A.

Hey there, this is effectively the matching method I use for these types of workflows. You can add an extra step before matching using a List.ContainsItem node, to filter out which sets of data don’t have a match back in the model.

Hope it helps: Retrieve Revit elements by Id using Dynamo! - YouTube

3 Likes

Thank you @GavinCrump for the input

I will give it a try. :slight_smile:

1 Like