HELP : Add 2 lists values by value parameter

Hello ,

My first need here and my second try with Dynamo.

I try to add value from 2 lists by parameter value.

Exemple in this picture :
I want sum of values for each “APPT” value.

Don’t sure to be really clear with my bad spell level in english.

Thanks for your help.

EDIT : Find an information about GroupbyKey. Try to use id.

If I get it right, just type this formula in a code bloc:

a + “-” + b;

and plug your 2 lists in. You could also need a Math.Round node after your list of doubles

Hey @Yna_Db and thanks.
Your formula work but I’ve find another way to do it since my ask. (but it show me that I must learn a lot about Python code)

I use List.GroupByKey And use Math.sum with the Group and have another list with my key Appt.
Now I have 2 lists : Appt with unique key (A001, A002, A003, …) and Area with sum for each key.

My big problem is now to set the value of the Area list to each each Room where Appt is equal to one value of the second list…

Think I didn’t take the good way to do it …

You could need a Dictionary.ByKeysValues from spring nodes for this.See here how it works:

1 Like

Sorry for my late and thanks again @Yna_Db.
I’ve tried a lot of solution but it doesn’t work.
Now I’ve got 2 lists Surf. and Appt.
I’ve got a room with a parameter which value are A001 and A002 for the example.
I want to compare this parameter with APPT.list, obtain the index to find the SURF. List value and affect this value to my room.

Unable to find the good function to do it :frowning:

Anyone can help me ? an idea ? please ?

Is this what you need?

1 Like

You are wonderful…

I need to adjust some things but Spring.Dictionnay works really fine.

Can’t achieve this without you. Thank you

(now, I must filter to remove unplaced rooms)

Hi @ATII

You should ask your next query by creating a new thread it is off topic. Thanks :slight_smile:

Yes @Kulkul, it’s look like I want an answer here, but it doesn’t.

I’ll ask it later. It’s great for me to achieve this first part of my script :wink:

Have a nice day.