# HELP : Add 2 lists values by value parameter

**URL:** https://forum.dynamobim.com/t/help-add-2-lists-values-by-value-parameter/8670
**Category:** Lists-Logic
**Created:** [January 6, 2017, 2:11pm UTC](https://forum.dynamobim.com/t/help-add-2-lists-values-by-value-parameter/8670 "2017-01-06T14:11:05Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![ATII](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@ATII](https://forum.dynamobim.com/u/ATII)
#### Post date: [January 6, 2017, 2:11pm UTC](https://forum.dynamobim.com/t/help-add-2-lists-values-by-value-parameter/8670/1 "2017-01-06T14:11:05Z")

</div>

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.

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/f/aff9a50b25aa0179eb4a3e539fe4294e96225558.png)

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.

---

<div class="post-metadata">

### Author: ![Yna\_Db](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/yna_db/32/30641_2.png) [@Yna\_Db](https://forum.dynamobim.com/u/Yna_Db)
#### Post date: [January 6, 2017, 3:04pm UTC](https://forum.dynamobim.com/t/help-add-2-lists-values-by-value-parameter/8670/2 "2017-01-06T15:04:15Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ATII](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@ATII](https://forum.dynamobim.com/u/ATII)
#### Post date: [January 6, 2017, 3:10pm UTC](https://forum.dynamobim.com/t/help-add-2-lists-values-by-value-parameter/8670/3 "2017-01-06T15:10:55Z")

</div>

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.

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/9/f9ba5260bf47f29b22c63227a5fa7d4cc90ce2a9.png)

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 …

---

<div class="post-metadata">

### Author: ![Yna\_Db](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/yna_db/32/30641_2.png) [@Yna\_Db](https://forum.dynamobim.com/u/Yna_Db)
#### Post date: [January 6, 2017, 3:14pm UTC](https://forum.dynamobim.com/t/help-add-2-lists-values-by-value-parameter/8670/4 "2017-01-06T15:14:45Z")

</div>

You could need a _Dictionary.ByKeysValues_ from _spring nodes_ for this.See here how it works:

> [@Place detail family as symbol for fire protection values of doors](https://forum.dynamobim.com/t/place-detail-family-as-symbol-for-fire-protection-values-of-doors/7287/9):
>
> The Dictionary.ByKeysValues node simply maps the list of values (=keys) with the list of symbols types (in List.Create), and returns as a result a list of symbols instances accordingly to the parameter values from the existing elements (=searchKeys). The parameters syntax in code blocks depends on the parameter type. When parameters change, to re-run the script should be enough, there’s apparently no need to delete anything (at least that’s what I see).

---

<div class="post-metadata">

### Author: ![ATII](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@ATII](https://forum.dynamobim.com/u/ATII)
#### Post date: [January 11, 2017, 1:16pm UTC](https://forum.dynamobim.com/t/help-add-2-lists-values-by-value-parameter/8670/5 "2017-01-11T13:16:47Z")

</div>

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 ☹

Anyone can help me ? an idea ? please ?

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/9/99f0165e7188a040e827ba2e0ece918e65caf50e.png) ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/1/21b7fa19db81fce3822e312eaef5a8665be6fefa.jpg)

---

<div class="post-metadata">

### Author: ![Yna\_Db](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/yna_db/32/30641_2.png) [@Yna\_Db](https://forum.dynamobim.com/u/Yna_Db)
#### Post date: [January 11, 2017, 2:02pm UTC](https://forum.dynamobim.com/t/help-add-2-lists-values-by-value-parameter/8670/6 "2017-01-11T14:02:16Z")

</div>

Is this what you need?

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/6/e6b592618c20ee5f6c32ad1cd31c6a775b8094df.JPG)

---

<div class="post-metadata">

### Author: ![ATII](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@ATII](https://forum.dynamobim.com/u/ATII)
#### Post date: [January 30, 2017, 3:02pm UTC](https://forum.dynamobim.com/t/help-add-2-lists-values-by-value-parameter/8670/7 "2017-01-30T15:02:03Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)
#### Post date: [January 30, 2017, 3:06pm UTC](https://forum.dynamobim.com/t/help-add-2-lists-values-by-value-parameter/8670/8 "2017-01-30T15:06:33Z")

</div>

Hi @ATII

> [@ATII](#):
>
> now, I must filter to remove unplaced rooms

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

---

<div class="post-metadata">

### Author: ![ATII](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@ATII](https://forum.dynamobim.com/u/ATII)
#### Post date: [February 3, 2017, 10:42am UTC](https://forum.dynamobim.com/t/help-add-2-lists-values-by-value-parameter/8670/9 "2017-02-03T10:42:41Z")

</div>

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 😉

Have a nice day.
