- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2022 07:53 AM - edited 10-06-2022 07:57 AM
Hi all,
we have a custom widget in our portal that is showing the results of a GlideRecord query. The results are presented via an ng-repeat in the HTML to show columns and rows of the returned records. I'm looking for how to pass the results to the widget's HTML so they are sorted first by a date field on the table, and then alphabetically by a "Requested for" field.
I see how to sort by date and also how to sort by alphabetically using orderBy();, but how do I achieve the sort by both?
So results would be something like this...sorted first by Date, and then within a date sorted by "Requested for" first name:
Date Requested for
4/5/2022 Joe Employee
4/5/2022 Rick Otherguy
4/5/2022 Sue Accountant
4/6/2022 Anne Lawyer
4/6/2022 Fred Judge
any help would be great...thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2022 11:14 AM
This turned out to be easier than expected...just needed to add the orderby() for the date field and for the name field, and then when pushing the data to the array the date needed to be included as the display value. Dates sorted, and then within each date the results are sorted alphabetically. See screenshot for script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2022 07:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2022 11:14 AM
This turned out to be easier than expected...just needed to add the orderby() for the date field and for the name field, and then when pushing the data to the array the date needed to be included as the display value. Dates sorted, and then within each date the results are sorted alphabetically. See screenshot for script.