# How to sort out values from the list by doing a comparison to each value on the list?

**URL:** <https://community.thunkable.com/t/how-to-sort-out-values-from-the-list-by-doing-a-comparison-to-each-value-on-the-list/163271>\
**Category:** Questions about Thunkable X\
**Tags:** beginner\
**Created:** [July 31, 2019, 9:02am UTC](https://community.thunkable.com/t/how-to-sort-out-values-from-the-list-by-doing-a-comparison-to-each-value-on-the-list/163271 "2019-07-31T09:02:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chanda\_Simfukwe](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/chanda_simfukwe/32/32125_2.png) [@Chanda\_Simfukwe](https://community.thunkable.com/u/Chanda_Simfukwe)\
**Post date:** [July 31, 2019, 9:02am UTC](https://community.thunkable.com/t/how-to-sort-out-values-from-the-list-by-doing-a-comparison-to-each-value-on-the-list/163271/1 "2019-07-31T09:02:02Z")

</div>

Hello guys,

I am trying to get values from an on create list e.g. I have a list of this numbers 234,45,856,879, and 255 added to a list as the time fires and I would like to get 45 or values less than 255 when the values are added to the list and list those wanted values on a different list? Any clue. @CBVG

Thanks

List of values adding items on a list as the timer fires and I want to be sorting out the values and list them on a different list view when all values are added to the list?

 ![2019-07-31%20(3)](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/d/3d2ae0b6214c7a6608639128229fca74d3ef4020.png)

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [July 31, 2019, 9:34am UTC](https://community.thunkable.com/t/how-to-sort-out-values-from-the-list-by-doing-a-comparison-to-each-value-on-the-list/163271/2 "2019-07-31T09:34:12Z")

</div>

### Raw Data

Not sure where your raw data comes from, but for the sake of this example I created 30 pieces of random data with this loop:

 ![07](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/4/64e16939e8852fde4732369288d0bcdd56fd164a.png)

### Filtered Data

This is where the second list comes into use. We loop through all of the `rawData` and if it’s lower than 50 it gets appended to the `filteredData` list like so:

![27](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/4/143f1cee31308654d14cb2b913389916bab991ca.png)

### Sorted Data

There’s also a `sort` block that allows for ascending or descending sorting, so a third list is created to store the `sortedData` and use like so:

 ![51](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/6/363caa077d48b62102b3e678ce34a1d9846dbfdc.png)

---

<div class="post-metadata">

**Author:** ![Chanda\_Simfukwe](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/chanda_simfukwe/32/32125_2.png) [@Chanda\_Simfukwe](https://community.thunkable.com/u/Chanda_Simfukwe)\
**Post date:** [July 31, 2019, 12:51pm UTC](https://community.thunkable.com/t/how-to-sort-out-values-from-the-list-by-doing-a-comparison-to-each-value-on-the-list/163271/4 "2019-07-31T12:51:50Z")

</div>

Thanks for the quick response and the logic on how to go about it, it worked.

---

<div class="post-metadata">

**Author:** ![Chanda\_Simfukwe](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/chanda_simfukwe/32/32125_2.png) [@Chanda\_Simfukwe](https://community.thunkable.com/u/Chanda_Simfukwe)\
**Post date:** [July 31, 2019, 1:16pm UTC](https://community.thunkable.com/t/how-to-sort-out-values-from-the-list-by-doing-a-comparison-to-each-value-on-the-list/163271/5 "2019-07-31T13:16:11Z")

</div>

Another question, how can I separate indexes from the list e.g as you created a list of rawdata 30 times. If you just want the list values in index 1,2,3,4 and 5 then display them and filter them out in Thunkable Classic? Thanks.

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [July 31, 2019, 4:00pm UTC](https://community.thunkable.com/t/how-to-sort-out-values-from-the-list-by-doing-a-comparison-to-each-value-on-the-list/163271/6 "2019-07-31T16:00:08Z")

</div>

These blocks will get the first 5 values from the list of `rawData` and store them in the `filteredData` list.

 ![28](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/6/e6d776834009b39afd2383b37b040df13e67163b.png)

The logic is the same for either platform. As a side note, please post any questions about Thunkable Classic in #classicdiscuss

Thanks.

---

<div class="post-metadata">

**Author:** ![Chanda\_Simfukwe](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/chanda_simfukwe/32/32125_2.png) [@Chanda\_Simfukwe](https://community.thunkable.com/u/Chanda_Simfukwe)\
**Post date:** [August 2, 2019, 1:30am UTC](https://community.thunkable.com/t/how-to-sort-out-values-from-the-list-by-doing-a-comparison-to-each-value-on-the-list/163271/7 "2019-08-02T01:30:08Z")

</div>

I apologize for the wrong tag, thanks so much for the help it worked. I have another question,

1-How can i sort out the highest value from the listed raw data, when the list is created?  
2-How can i test for each number in a listed rawdata e.g if the values are being added and the values added are constant it does not sort out the values, if they is any change i want the program to list the values that are changing in a list?

Second Question Reference Example  
List-255,255,255,255,255,56,59

As given a list of values above, the program will check were the values have stopped being constant it can be any value in the list and those values were a change happened will be sorted out, example to the reference list above 56 and 59 will be sorted out and also the constant values…?

Thanks!

---

<div class="post-metadata">

**Author:** ![Daniel\_Coglitore](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Daniel\_Coglitore](https://community.thunkable.com/u/Daniel_Coglitore)\
**Post date:** [August 3, 2019, 2:42pm UTC](https://community.thunkable.com/t/how-to-sort-out-values-from-the-list-by-doing-a-comparison-to-each-value-on-the-list/163271/8 "2019-08-03T14:42:50Z")

</div>

Check out all the Maths and list components everything you asked for is possible and is easy to do !

some blocks do more than they show, so try all the functions that each math blocks and list blocks do!

---

<div class="post-metadata">

**Author:** ![Chanda\_Simfukwe](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/chanda_simfukwe/32/32125_2.png) [@Chanda\_Simfukwe](https://community.thunkable.com/u/Chanda_Simfukwe)\
**Post date:** [August 7, 2019, 5:55am UTC](https://community.thunkable.com/t/how-to-sort-out-values-from-the-list-by-doing-a-comparison-to-each-value-on-the-list/163271/9 "2019-08-07T05:55:50Z")

</div>

Thank you, I will test all the Maths and List blocks and see what I can come up with.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 12:11pm UTC](https://community.thunkable.com/t/how-to-sort-out-values-from-the-list-by-doing-a-comparison-to-each-value-on-the-list/163271/10 "2024-11-08T12:11:54Z")

</div>


