How-To: Sorting by Timestamps within groupBy()

When collating a group of field data that includes a field that you also want to sort on, use the collect() and use an embedded call to the sort() function in your aggregate function call.

For example, if you are reporting on data that you want to summarize by a field value and a formatted timestamp, you can sort the collected fields with by the timestamp using this format:

Click + next to an example below to get the full details.

Sort Timestamps With groupBy()

Sorting fields based on aggregated field values