Sorting Variables To Find Top 2Sorting Variables To Find Top 2https://portal.smartbuilder.com/c/message_boards/find_thread?p_l_id=&threadId=5716022024-03-28T12:32:54Z2024-03-28T12:32:54ZRE: Sorting Variables To Find Top 2Navdeep Dhillonhttps://portal.smartbuilder.com/c/message_boards/find_message?p_l_id=&messageId=5716272023-05-16T16:28:52Z2023-05-16T16:23:00ZHi Bryan,<br />Great question! Yes, it's possible, and creating a bunch of conditions would be a pain. Here's how you can sort a list of values, and then work backwards using a second list of names to figure out the order.<br />Video: <a href="https://share.smartbuilder.com/public/support/sorting-values.mp4">https://share.smartbuilder.com/public/support/sorting-values.mp4</a><br />Sample file: <a href="https://share.smartbuilder.com/public/support/sorting-values2.sb4">https://share.smartbuilder.com/public/support/sorting-values2.sb4</a><br /><br />Since we spoke last, we found out there's already a block that sort of handles this. Check out page 2 of file above. It requires formatting the data in a particular way - a List, and each entry in that List is a Map with two entries - <strong>name</strong> and <strong>count</strong> (those names are arbitrary, they could be <strong>category</strong> and <strong>score</strong>). With this method the logic is much simpler (one action block to sort), but the overhead of putting it in the right format and extracting the data that you need is higher.<br /><br />List of Maps video: <a href="https://share.smartbuilder.com/public/support/sorting-values-part2.mp4">https://share.smartbuilder.com/public/support/sorting-values-part2.mp4</a><br /><br />Let us know if you have any questions!Navdeep Dhillon2023-05-16T16:23:00ZSorting Variables To Find Top 2Bryan Lamberthttps://portal.smartbuilder.com/c/message_boards/find_message?p_l_id=&messageId=5716012023-05-16T15:12:43Z2023-05-16T15:12:43ZI'm looking for the best way to sort five variables largest to smallest while retaining their identification. <br /><br />In my project, I'm accumulating scores in five categories, and need to know what the top two categories are based on the scores. I'm sure I could create a bunch of conditional statements to work it out but I'm thining there's an easier way.<br /><br />Thanks!Bryan Lambert2023-05-16T15:12:43Z