Group by date/time field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 04:50 AM
Hello Everyone,
I have to write a code in which the requirement is to count how many records were created in one particular day.
I have to use the record's created field, and we cannot use Group By in a Date/time field.
So kindly suggest a code to find respective count using Glide Aggregate, by :-
1- First converting the Date/Time as Date.
2. Getting count of record created on one particular date.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2019 11:29 AM
Hi,
try using the following code as example:
var count = new GlideAggregate('u_check_in');
count.addQuery('sys_created_on', '>', gs.beginningOfYesterday());
count.addAggregate('count');
count.query();
var result = 0;
if (count.next())
result = count.getAggregate('COUNT');
gs.log('Result: ' + result);
Hope this will be useful for your need!
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
Thank you
Cheers
Alberto

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2019 03:45 AM
Any update on this?
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
Thank you
Cheers
Alberto