Setting a Parameter - Matching Question

I have floors in the project with areas and I am wanting to take those areas and fill in a parameter of a model group. I have filtered down the floors to the ones I need and I’ve filtered down the model groups I need.

The question is how do I tell Dynamo to match these two lists by a similar string so that the correct areas fill in the correct parameters?

Example:
Floor - Type “2A - NET”
Model Group - Name “Unit 2A”

I need to take the floor area from Floor '2A - NET" and populate the shared parameter of model group “Unit 2A”. They both contain ‘2A’, so it seems like I could tell dynamo to find the match of those strings.

Thanks

Assuming your naming convention is standard, then you just need to break down both names to the “key” portion that ties them together. For floor type, you can split the string at the “-” and take the unit name. For the model group you can just remove “Unit” to leave the unit name.

It’s way better to make a specific comparison with like terms than to look for “similar” matches.

So I might be overthinking this because it seems like it shouldn’t be too difficult.

I have floors that we are using to generate areas. I want to use dynamo to take those areas and populate shared parameters in a model group.

I’ve isolated the Gross and Net Floors and the Model Groups. But I’m having trouble figuring out the next step in taking that info and using it. I think my primary issue is getting all the lists in the same order. I’ve replaced parameters before but both lists were already in the same order.

@Nick_Boyts I split the strings like you suggested but I couldn’t figure out how to reorder them so the lists matched. You can see in the image that the Gross Floors start with ‘E1-G’ and the Model groups start with ‘E1’. This is why I was originally hoping there was a way to scan each list to find matching strings and sort that way?

Unfortunately the image is illegible. Try again with the preview bubbles pinned and the node titles visible when you use the Export as Image button.

Do E1 and E1-G match? If so, then you need to deal with that logic. If they’re just different values in a different order then you need to use one of the many processes to reorder lists. Sort- and GroupByKey might be an option if you have all the same values in both lists. Otherwise you may need to use a filter to check each value individually.

There are tons of topics that cover this type of problem. Any of the Excel to Revit topics will probably cover this.

I’m working through this and making progress and learning.

So I thought I was using the sort by keys correctly, but something isn’t correct. In the screenshot I have narrowed down the list of types to the 41 I need. I then used that with sort by key and grabbed the floors. The sort by keys in still in the correct order, but the sorted list is not in the same order.

The element in position 5 is a different floor type than the item 5 in the sorted keys list.

Floor area fill-ins.dyn (132.3 KB)

Hard to tell without seeing the whole graph, but it looks like you sort the names before using SortByKey. Sorting the names will mean that they don’t match the original list. That’s the whole point of SortByKey: sort one list based on a different (but matching) value.

If both lists (areas and floors) have the same key values, then you should be able to sort and group both lists separately and still end up with the same order.

1 Like

Adding in an extra SortByKey did the trick. Thanks for helping me out with this!

1 Like