How To Sort List of Maps?
I have the following below; If I return Collection(keyList) at the bottom, keyList is sorted correctly (I've tried both true and false and it works). But when I add to my sortedList in the order of my keyList the sortedList is not sorting how I want - its just returning unsortedList as-is. I got this syntax/help from another website...any other ideas out there?
- unsortedList = invokeurl
- [
- url :"https://api.discogs.com/database/search?token=helloZoho"
- type :GET
- parameters:paramsMap
- ];
- sortKey = "id";
- keyList = List();
- for each u in unsortedList.getJson("results")
- {
- keyList.add(u.getJson(sortKey));
- }
- keyList = keyList.distinct().sort(true);
- sortedList = List();
- for each k in keyList
- {
- for each u in unsortedList
- {
- if(u.getJson(sortKey) == k)
- {
- sortedList.add(u);
- }
- }
- }
- return Collection(sortedList);
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Zoho Orchestly Resources
Zoho Creator Resources
Zoho WorkDrive Resources
Zoho Campaigns Resources
Zoho CRM Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.