# Dictionary.SetValueAtKeys as list

**URL:** <https://forum.dynamobim.com/t/dictionary-setvalueatkeys-as-list/83195>\
**Category:** Lists-Logic\
**Created:** [November 17, 2022, 3:04am UTC](https://forum.dynamobim.com/t/dictionary-setvalueatkeys-as-list/83195 "2022-11-17T03:04:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lumoric](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/lumoric/32/153156_2.png) [@lumoric](https://forum.dynamobim.com/u/lumoric)\
**Post date:** [November 17, 2022, 3:04am UTC](https://forum.dynamobim.com/t/dictionary-setvalueatkeys-as-list/83195/1 "2022-11-17T03:04:42Z")

</div>

Hi,

I have created a list of dictionaries with list as one of the values for key “geometry”. Now I want to replace the value with the new list but it keeps putting only the first item of the list in the value. Dictionary at index 1 before had 2 items, now only one.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/d/0d3c7744a7c73e7468b8ae575e7979d53fceebc7.png)

But a workaround works where I extract keys and values as separate lists, then replace item from values list with the new one and recreate the dictionary

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

how can I get the SetValueAtKeys to work? I have a feeling that it’s simple and can’t be bothered creating new dictionary every time.

Hope I’m making sense,  
Luka

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [November 17, 2022, 3:12pm UTC](https://forum.dynamobim.com/t/dictionary-setvalueatkeys-as-list/83195/2 "2022-11-17T15:12:29Z")

</div>

First of all, careful if you’re not trying to update the geometry list of all those dictionaries at once.

You’re close with `SetValueAtKeys`. Keep in mind the list structure that the node is _expecting_ versus what you’re _supplying_. The node states both the `keys` and `values` inputs are expecting lists. So a list of `keys` corresponds with a list of `values`, i.e. it’s a one-to-one comparison. If you supply a singular `key` with a list of `values` the node will assume that the lists are mismatched and you’re missing some `keys`. In order to get around this you have to supply a singular `key` and a singular _list_ of `values`. (I know that’s kind of confusing.)

All of that is to say you probably need one more list level in your new `values`. For a singular dictionary you could also set the list level to be one above the size of the list. This would force the extra level and give the same result. But that won’t work when you already have the additional list levels due to a list of dictionaries.

Easier to see with a single dictionary.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/7/c7e45823810a63af1fe0da5a48e852d8010cdc1e.png)

Still works with multiple.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/b/8bb89a89f9ffc35624d00737172e780ab3a614f7.png)
