# How to list unique values

**URL:** <https://community.appfarm.io/t/how-to-list-unique-values/530>\
**Category:** Ask the community\
**Created:** [June 14, 2023, 5:39am UTC](https://community.appfarm.io/t/how-to-list-unique-values/530 "2023-06-14T05:39:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Preben](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/preben/32/545_2.png) [@Preben](https://community.appfarm.io/u/Preben)\
**Post date:** [June 14, 2023, 5:39am UTC](https://community.appfarm.io/t/how-to-list-unique-values/530/1 "2023-06-14T05:39:04Z")

</div>

Hi,

What is the best way to list unique values from a datasource?

E.g. I want to list all contractlines with a specific value, and I want to group them per contract header. So one contract header can have many lines. Some contract header might not have lines with the specific value and other contracts maybe have several lines with the specific value.

---

<div class="post-metadata">

**Author:** ![Simona](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/simona/32/201_2.png) [@Simona](https://community.appfarm.io/u/Simona)\
**Post date:** [June 14, 2023, 6:59am UTC](https://community.appfarm.io/t/how-to-list-unique-values/530/2 "2023-06-14T06:59:22Z")

</div>

Hi! You can list your values by using two repeating containers. In the first container you iterate your contracts data source, and in the second the contract lines data source. You can “connect” these two containers by using a filter on the second container, which displays all contract lines which correspond the contract in the header. You can also find an example in the [Showroom](https://showroom.appfarm.app/ui-components/list) (but there only one iterating container is used).

 ![Screenshot 2023-06-14 at 08.58.28](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/b0cfc12f8fede369ac4a2da8fadfb60b1d7331e3.png)

 ![Screenshot 2023-06-14 at 08.58.43](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/19d40e786edb3331507b4c39d59d7b41530cac0f.png)

---

<div class="post-metadata">

**Author:** ![Preben](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/preben/32/545_2.png) [@Preben](https://community.appfarm.io/u/Preben)\
**Post date:** [June 14, 2023, 9:09am UTC](https://community.appfarm.io/t/how-to-list-unique-values/530/3 "2023-06-14T09:09:26Z")

</div>

Thanks for your answer. So there is no other way then looping through all records to find the unique values?

There is no function similar to a SQL SELECT DISTINCT Statement?

---

<div class="post-metadata">

**Author:** ![kristian](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/kristian/32/58_2.png) [@kristian](https://community.appfarm.io/u/kristian)\
**Post date:** [June 14, 2023, 1:42pm UTC](https://community.appfarm.io/t/how-to-list-unique-values/530/4 "2023-06-14T13:42:27Z")

</div>

Hi!

You might extract these values from inside the function editor. In other words, extracting distinct values from an array of objects (array of objects = an Appfarm data source with cardinality “many”, added as a function parameter). However, outside the function editor, we have no generic “array” concept, only Object Classes in the Global Data Model. This is on the roadmap however (having e.g. a property/variable that is an array).
