This guide is an extension-free replacement for the ListUtils extension, if you do not know it, you can download it in All Extensions From AppyBuilder Community - #47 by Anke. This extension has been used for years (including me), but I recently discovered JavaScript solutions for this. Since you need extensions for Java code, but you do not need extensions for JavaScript, this is an extension-free method.
In this guide, I will be using two sample lists - a text-and-number list, and a number-only list. The number-only list will be used for finding minimum/maximum values, while the text-and-number list will be used for removing duplicates, sorting, and shuffling. I do know blocks-only solutions for this, this is just another method.
We will also have a list of action IDs to specify each action, e.g. sort, shuffle, to make life easier.
-
1: sort.
-
2: shuffle.
-
3: remove duplicates (note: a number block of 1 and a string of 1 are considered different).
-
4: max value.
-
5: min value.
You will need an invisible WebViewer and a string to complete this. Don't worry, you can always download the AIA file to copy the code.
You will need an action and targetList variable to check the targetted list and action. You can ignore numbersList and textAndNumbersList in your app, but make sure to set the target list.
Should be set by now!
Q & A
Q1: Does it support iOS devices?
A1: No, not yet, because the iOS companion has still not implemented the JsonObjectEncode block.
Q2: You forgot the reverse block.
A2: No I haven't, you can find a native reverse list block in the Lists drawer.
Downloads
AIA:
SortList.aia (5.6 KB)
Video
Kindly PM me if you have any questions! Also, if you like my tutorial, please like it! It takes some effort for me to make it...
Likes tell me the general user feedback of my tutorial, and they keep me motivated. If you read this tutorial, please take 10 seconds to drop by and give a like if you like it!
If you have any features that you want to add to this tutorial, PM me or reply directly here.
Gordon Lu