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);
Access your files securely from anywhere
Zoho Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.