# Unique keys order not matching: Brutto areas vs Room areas

**URL:** <https://forum.dynamobim.com/t/unique-keys-order-not-matching-brutto-areas-vs-room-areas/91025>\
**Category:** Lists-Logic\
**Tags:** dynamo\
**Created:** [June 22, 2023, 12:26pm UTC](https://forum.dynamobim.com/t/unique-keys-order-not-matching-brutto-areas-vs-room-areas/91025 "2023-06-22T12:26:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pedroabalada](https://avatars.discourse-cdn.com/v4/letter/p/ea666f/32.png) [@pedroabalada](https://forum.dynamobim.com/u/pedroabalada)\
**Post date:** [June 22, 2023, 12:26pm UTC](https://forum.dynamobim.com/t/unique-keys-order-not-matching-brutto-areas-vs-room-areas/91025/1 "2023-06-22T12:26:51Z")

</div>

Hi Forum

I am trying to understand why dynamo does not order unique keys for brutto areas and room areas since the parameter is the same (Building name)

 ![Unique key list not matching](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/5/f5ea42bbd3d069ef5228d96d7ab7ed2f905bbb23.png)

I have also tried List.Sort to one of the List.GroupByKey node but then somehow the areas become mixed in the wrong Building number.

Any input would be highly appreciated to this new user in Dynamo. 🙂

Best Regards,  
Pedro A.

---

<div class="post-metadata">

**Author:** ![Joelmick](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/joelmick/32/93148_2.png) [@Joelmick](https://forum.dynamobim.com/u/Joelmick)\
**Post date:** [June 22, 2023, 12:57pm UTC](https://forum.dynamobim.com/t/unique-keys-order-not-matching-brutto-areas-vs-room-areas/91025/2 "2023-06-22T12:57:14Z")

</div>

Try List.SortByKey

 ![Schermafbeelding 2023-06-22 145659](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/7/e79e003d870c12436b06831183c5cb4aafb28a4c.png)

---

<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:** [June 22, 2023, 2:07pm UTC](https://forum.dynamobim.com/t/unique-keys-order-not-matching-brutto-areas-vs-room-areas/91025/3 "2023-06-22T14:07:46Z")

</div>

> [@pedroabalada](#):
>
> I am trying to understand why dynamo does not order unique keys for brutto areas and room areas since the parameter is the same (Building name)

Because the data is not the same. GroupByKey groups the list based on the keys available. If the first key (value) is 0019 then the first group will be 0019. The order of the grouped keys is the order in which they were found within the list you provided. It’s specifically _not_ sorting them.

As @Joelmick showed, you can either sort before or after grouping, but you _must_ sort both outputs if you want the relationship to stay in tact.

---

<div class="post-metadata">

**Author:** ![pedroabalada](https://avatars.discourse-cdn.com/v4/letter/p/ea666f/32.png) [@pedroabalada](https://forum.dynamobim.com/u/pedroabalada)\
**Post date:** [June 22, 2023, 2:49pm UTC](https://forum.dynamobim.com/t/unique-keys-order-not-matching-brutto-areas-vs-room-areas/91025/4 "2023-06-22T14:49:57Z")

</div>

That solved my issue right there. Thank you @Joelmick 🙂

Thank also to you @Nick_Boyts for the explanation. 😉
