# How to Sort an Array?

**URL:** <https://community.make.com/t/how-to-sort-an-array/15520>\
**Category:** Questions\
**Created:** [September 6, 2023, 3:26pm UTC](https://community.make.com/t/how-to-sort-an-array/15520 "2023-09-06T15:26:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_Krausz](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sam\_Krausz](https://community.make.com/u/Sam_Krausz)\
**Post date:** [September 6, 2023, 3:26pm UTC](https://community.make.com/t/how-to-sort-an-array/15520/1 "2023-09-06T15:26:41Z")

</div>

Which function should I use to retrieve the smallest Order ID when I only need one?

 ![Screenshot_6](https://europe1.discourse-cdn.com/flex013/uploads/make/original/2X/0/0a634bfe59e249a29b4495fb8fe71cb7a3dbe8cd.png)  
 ![Screenshot_5](https://europe1.discourse-cdn.com/flex013/uploads/make/original/2X/9/9d08743794b658224010466bebcd40329ac6ac80.png)

---

<div class="post-metadata">

**Author:** ![pierre\_fey](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/pierre_fey/32/28247_2.png) [@pierre\_fey](https://community.make.com/u/pierre_fey)\
**Post date:** [September 6, 2023, 4:29pm UTC](https://community.make.com/t/how-to-sort-an-array/15520/2 "2023-09-06T16:29:00Z")

</div>

[] is already the first item in the array. What do you wanna do exactly. If you want to get the data from the first Item (order\_id, order\_status etc) you can use the map-function.

Take a look here [Getting data from a bundle? - #2 by guuyef](https://community.make.com/t/getting-data-from-a-bundle/15337/2)

or use the [make.com](http://make.com) docu

---

<div class="post-metadata">

**Author:** ![Sam\_Krausz](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sam\_Krausz](https://community.make.com/u/Sam_Krausz)\
**Post date:** [September 6, 2023, 5:57pm UTC](https://community.make.com/t/how-to-sort-an-array/15520/3 "2023-09-06T17:57:03Z")

</div>

I need to obtain the item with the lowest order\_id. While it’s sometimes the first item and at other times the second, my goal is to get the one with the smallest order\_id, as illustrated in the image below:

![Screenshot_7](https://europe1.discourse-cdn.com/flex013/uploads/make/original/2X/6/699b0561e5517f771c18903e823edf8939c1b8cc.png)

---

<div class="post-metadata">

**Author:** ![Baudouin\_MARBACH](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/baudouin_marbach/32/14297_2.png) [@Baudouin\_MARBACH](https://community.make.com/u/Baudouin_MARBACH)\
**Post date:** [September 6, 2023, 9:56pm UTC](https://community.make.com/t/how-to-sort-an-array/15520/4 "2023-09-06T21:56:19Z")

</div>

![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/2X/f/fb7c3383fbac8877d5d1cf37aed3a01df88d5aab.png)  
@Sam_Krausz

you need to use the map function to get value from order\_ID, and concatenate with first function to get the smallest value.  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/2X/6/6884e31150bcf5a3f51bb2bba75ef9f5633e82bc.png)

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/2X/f/f029ba2b0729cf494f90d30c53c1dfccd3ad9dcc.png)

---

<div class="post-metadata">

**Author:** ![Make\_Bot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/make_bot/32/14661_2.png) [@Make\_Bot](https://community.make.com/u/Make_Bot)\
**Post date:** [December 7, 2023, 5:38pm UTC](https://community.make.com/t/how-to-sort-an-array/15520/6 "2023-12-07T17:38:50Z")

</div>

This topic was automatically closed because it's resolved or inactive. Please, start a new topic.


