Alphanumerical sorting or grouping Rooms by specific Parameter (Room_Number)

Hello everyone, need your Help please…
What i’m trying to do actually is exporting data into Excel file by sorting Rooms by Number using Dynamo with other parameters like Room_Name; Room_Wall_Finish, Room_Ceiling_Finish and Room_Base_Finish

This is what i’ve done in Dynamo:

And this what i’ve got in Excel file:

How can i SORT Rooms by Room_Number in Order ?
Thank you in advance.

If you want to import your data from Excel back in Revit, maybe its best to include the Id (or UniqueId in workshared Revit files) of the Rooms in your data.
Its a lot easier to get data to match the Id opposed to the Room Number, but that works as well.
So sorting is not needed, or can be done in Excel itself.

1 Like

First up, delete all of the ‘GetParameterValueByName’ nodes but one. Use list lacing and levels to get the data you are after in the right order from the single node you keep on canvas. This will make your graph much simpler to follow the logic, and faster too.

Second: add another GetParameterValueByName node to pull the room number, and use that as a key in a List.SortByKey node to sort your lists of rooms by the associated number values. The output from that node will be the input into the one original ‘GetParameterValueByName’ node.

2 Likes

Hi @jacob.small I followed your recommendations and it works perfectly, Thank you so much !
I’ve a question if you don’t mind, Like @Marcel_Rijsmus said, may i use the node: List.UniqueItems as shown in the graph If i want to import my data from Excel back to Revit ?

Read my answer again, no mention of List.UniqueItems there.
I was referring to the Id or the UniqueId of the Rooms

2 Likes

Unique ID is much better for moving the data back into Revit than the room number, as room numbers change and update all the time. Unique IDs are 100% static and always unique for any element in a project, so less worries about ‘what if a second room gets name 01a accidentally?’

2 Likes

Hi @Marcel_Rijsmus, thank you for your NOTE, sorry but i’m just a new user of Dynamo :slight_smile:
By using the node “Element.UniqueId” i’ve to create a new parameter for rooms called for exemple “Unique ID” then then feed this new parameter by using the node: Element.SetParameterByName ?

Is that right now ?

When you have updated your data in excel and are ready to bring it back into Revit you need
a code block like this
image
It will work in the same way as the Revit button Select by Id in the Manage tab.

1 Like

Hi @Marcel_Rijsmus, i tried to use the code block as you said, but still have a message error

So, i tried to use “Element.UniqueId(Pink group) to extract the ID of each room, but i don’t know if it’s okey or not?


Here is my .dyn file Export Dynamo to Excel using UniqueID.dyn (40.8 KB)

You should use that code block in the script where you update your Rooms once you have your Excel file completed.
Here is some more explanation.

1 Like

Hi @Marcel_Rijsmus I followed your advice which was very useful and i applied it for my job and it works perfectly…

Sorting rooms by “Room_Number_Parameter” before exporting to Excel was the problem. So, once i export the data to excel, then i sort the data within Excel by a specific column which is in my case “Column B” corresponding to my Room_Number.

You made my day guys @Marcel_Rijsmus & @jacob.small, thank you very much !

Here’s the screen shot of the graph

and also, the .dyn script if someone need it.
Export Dynamo to Excel using UniqueID.dyn (49.7 KB)

1 Like