Group by Multiple Criteria

My question is how do I apply a unique code to Curtain Panel family parameters which share 3 common parameters. A unique code is created from these combinations. I would like to find all Curtain Panels which share these parameters and apply the appropriate unique code. In my example I have Bottom and Top parameters within one Curtain Panel family.

I am able to make a report of all of the glass types in my Revit Curtain Panels. The report assigns a unique code to each type of glass. The types are based on common material, width and height. For instance, there may be 100 Curtain Panels but there are only 2 unique types:

Unique code: V1
Material: GL1
Height:2400
Width:400

Unique code: V2
Material: GL1
Height:2000
Width:800

Here’s what I have so far in Dynamo.

Glass Report.dyn (88.6 KB)

SAMPLE_Curtain Wall Panel Numbering_purged_R19.rvt (1.6 MB)![unique%20code%20to%20parameters|682x500]

I would probably concatenate your three parameter values into a single string and compare those. That way you don’t have to deal with each parameter individually.

Thanks Nick,

I think I did that. It works for the report but once I assign a code to the unique items I want to write that code back to the panel parameters.

I think your looking for the dictionary nodes. They are amazing. For every instance of your combination of parameters you can write a code back to all the revit elements with that certain combination

Thanks JoshuaB,

Yes, I have been experimenting with those. I can assign the keys and values but I’m having a hard time grouping the lists by those keys. How do I take a value from another list and tell it’s a particular key or value from the Dictionary?

Exactly what @JoshuaB said. You want a dictionary to assign all your values based on the unique objects you have.


I used GetKeys just to get a quick value, but you would use your unique code.

You need search by key I think. Its a dictionary node with 3 inputs. You can compare a list with the dictionary list. Im not at my pc at the moment.

Edit. It’s Dictionary.ByKeysValues I think

You can also use a code block:

1 Like

Thank you both, I feel I am getting closer but still going in circles. I have the Dictionary, I have the List, now I need to group the List by the Dictionary and apply the unique codes to the corresponding values.

The node should look like this

Here’s an image with a more specific problem to solve. I need to group list1 according to the keys of list2. I also need to apply the keys. This should create a list3.

Part of the benefit of a dictionary is that you don’t have to group objects. Every object will check a key against the dictionary and return the correct value. Use the GetValueFromDictionary node to get the unique code based on the elements key.

The first image I posted shows you what you’re looking for.

But I want to group the elements so I can apply the dictionary key to the family parameters automatically.

It’s not necessary. You don’t need to apply the code from the unique list of values. The dictionary will return the matching code based on the value you give it, so all of your elements will have a code value to apply.

So how would one create list 3 from my example image above?Glass Report-sample1.dyn (19.2 KB)

Look at the image I shared. First of all your keys and values are flipped. The “key” is the lookup value and the “value” is the returned value. You create a dictionary that will look up unique code (values) based on the concatenated parameters (keys). You can then use the GetValueFromDictionary node along with the dictionary you’ve created (or the Springs node Joshua and I recommended or the code block I showed you) to get the unique value of each element depending on its concatenated parameters.

I’m sorry Nick but I’m not following you. I’m very new to Dictionaries. I tried doing as you described but I still do not get a list of 4 items as described in my image below (list 3).

This is the list I’m trying to get-list3.

You’re so close. You build your dictionary with the first node. So now you have a list of Values that are tied to a list of Keys. The second node, GetValueFromDictionary, will return the dictionary Value for any Key you input. So you want to use the concatenated parameter values from your list of elements as your Key input. This will return the corresponding Values (code) for each element.

Strange, it’s making the list but returning null values.

That is strange. Try using the Springs node or the code block.

1 Like