List.sort (string objects) vs Elements from and to Excel

Hi all,

My name is Marcel and currently I’m stuck on a challenge for checking values from Revit and Excel and writing the updated values from Excel into Revit.

I’m got a model with at least 395 rooms, which have all been numbered in the past (based on the number parameter, which is an instance parameter in the file).
And I’ve got an excel file with sort of the same room numbers.

My first step was to identify the rooms by checking the list through boolean values. Based on the “number” parameter and the room numbers I’ve got a checking mechanism in place which tells me if the rooms are true or false and therefore are corresponding with each other.

So far so good, but the next step is to write the excel data based on the list.sort node into Revit (filtered on an instance parameter). Except the “Set parameter value by name” is related to the “Element” data type. And the sorted list I’ve got as an output, which paired the objects provided me with a string output. This does not match, and gives the error shown in the image below.

Can someone help me with this?
Much appreciated.


Marcel

You need to learn about FilterByBoolean.

1 Like

Hi Bjorn.

Thanks for the answer in such a short notice.
With the solution you provided, the order of the selected elements (Rooms in this case) is not changed.
Within the image I’ve uploaded, I’ve tried to accomplish the same, but with also changing the elements in order based on an ascending index related to an instance parameter.

With the solution you provide, my filter.boolbymask will always be false, since the structure of the revit components (list) is not filtered on the way I need it to be. And with it being false, nothing will be written to Revit.


Thanks in advance,

Greetings Marcel

The image was not a solution as such, but an example of how you can filter a list of elements by a property of those elements and condition, and still get the original element as an output.

So you select all your rooms, Get their (combined) number, Sort by that number. Get your excel data, sort in the same order.

Read the Room Number again from the reordered Rooms, compare those values to your excel values, getting a Boolean list. Use that Boolean list to FilterByBool the sorted Rooms. The “in” output are all the true values where you don’t need an action. The “out” output contains all the items where the numbers do not match.Those elements need a new value if I understood you correctly. Read the index from those elements from the original sorted list, use the same index on your sorted number list to get the corresponding values to push into the SetParameter Node.

1 Like