Combine and Optimise several Revit Schdules to Excel

Hi,
I would like to be able to create a list in Excel by selecting several lists in Revit and exporting a list which picks the largest quantity for each item from each list to create the final list in excel. Before I get too far into this, is this possible?

Basic example:
Revit List 1
Item A = 3
Item B = 5
Item C = 1

Revit List 2
Item A = 2
Item B = 9
Item C = 7

Revit List 3
Item A = 2
Item B = 14
Item C = 4

Final Excel List
Item A = 3
Item B = 14
Item C = 7

Any help is much appreciated!

Hi @JMozz,
Welcome to the Dynamo community.
Yes, it’s possible to do that through Dynamo.
I would suggest you post a sample Revit file or screenshots of your lists/schedules for the community to help you in a better way.

2 Likes

Thank you AmolShah! I will try to make some progress on the script first and post again when I get stuck :slight_smile:

1 Like

@AmolShah These are the lists I would like to compare. Note some families are only in one list, others are in both, and some have the same family but the lengths are different.

I take it I then need to extract the information from each list, and compare them?

Correct. It’s still a little unclear how you’re wanting to compare items across lists, but it sounds like you need to group the items first, then get the maximum value in each grouped sublist.

1 Like

Thanks for the reply Nick - this is my first attempt at a script after doing a basic dynamo training course. So any help is greatly appreciated!

What you are saying sounds correct. How would I go about grouping the lists into sublists?

You’d have to do some sort of identification of the line items first, whether that’s by family, type, mark, or whatever (it may even be different for each schedule). Then you’d combine all your identified items into a single flattened list and use GroupByKey to group all those elements based on their identifiers.

1 Like

I have created these lists from the schedules. Is GroupByKey the next step?

I think you’re close. First of all, I’d probably combine Quantity and Length into a total value (Q*L) so that you only have one value to compare. Just replace the empty lengths with a value of 1. Then you’ll want to use List.Join to combine the same lists from each schedule. The idea is that you have a list of all the items and a list of all the counts/lengths.

Based off your initial example, you’d want to do something like this:

Combining values would look like this:

1 Like

Hi Nick, Thanks again for your reply!
I’m not sure about combining the length and quantities, since I need to have these shown in the final list.
That brings up a good point actually - Items with length I need all instances to show in the final list rather than compare them so I think I need to handles these separately! Is there a way to separate these out before doing the comparison between the lists, so that I can add them back in after the list comparison is done?

Use FilterByBoolMask to filter out all the items that correspond with a value in the “Length” parameter line.

1 Like