How to reverse the "Sum Math" process to get elements

Hi Everyone! Thanks for all the help and Advice i have received from this forum!
This is what i have:


First of all, i have my “goal”: All areas from a roof type added to a single value, but now i tried to invert this to get elements for this “Total Area”. . . . i couldn’t, any help is welcome! Thanks in advance!

Can you please better explain what you are trying to do? I am lost.

So you want a list of all of the Roof elements that are part of your area calculation?

You mean these?


I hope to be explicit with the image.
It is for put a parameter value to all those elements which are involved in the sum. Thanks! @Robert_Younger @Steven

There’s no reason to “invert” it. As @Robert_Younger already suggested, you can just take the elements that you already filtered. It’s not uncommon to have to maintain elements and their parameters in parallel like this.

The script doesn’t need to follow a stream of consciousness. You can pull data from earlier sections as-needed, provided you maintain a useful list management.

In this explicit case, you can just List.Create the outputs of your two filters and List.Flatten if desired. Since you haven’t added/removed/modified elements at any point after the filter, the element list should be accurate to your sum.

Hi @Nick_Boyts ! , sorry if i’m not so clear maybe my english is not good. . . . allright then, my example is on 2 Roof types, but what if the list grow up to 5 Roof types, so i filtered types between them to get the area of each type, later there’s a “Mat.Sum” node to get a Total Area for each type, this is for “Compare” total Areas between types within the “List Create” node so i can order this list in a “List.SortNatural” node to put the High Value of Areas in the bottom of the list and “Pick it up” with the “Last.LastItem” node. With all this Workflow done, i would like to nest all the elements that are involved in the “Total Area” Picked, so i can put a parameter and its value to make a scheduled of them.
image

The number of roof types you have is a separate issue. In order to handle a dynamic number of types you need to filter everything as a singular list. You’ll probably want to use something like GroupByKey to keep your types grouped together.

For handling your elements with the same logic as the areas you just need to use SortByKey.

2 Likes

Sorry for my crude method of approach I am short on time.

Edit: Nicks answer above is the path that I would take.

Here’s an example of what I mean by handling everything as a single list. This way the number of types you have doesn’t matter.

1 Like

thanks a lot @Nick_Boyts @Steven @Robert_Younger for your time! As you wrote Steven, Nick’s 1st solution is gold!


Nick i’ll be trying your 2nd, so interested on it beacuse it will make the Script shorter. . and the number of types is ilimitated! Thanks a lot again!