GlideAggregate Count
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 02:27 PM
var agg = new GlideAggregate('sp_log');
agg.addQuery('page=5c639f611be0591028a38625624bcbf5^sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()');
agg.groupBy('user');
agg.addAggregate("COUNT");
agg.query();
while (agg.next()) {
gs.print("Count is "+agg.getAggregate("COUNT"));
}
Hello Community,
I am trying to pull unique number of users accessed some page through script using GlideAggregate but ideally I should get count 1 but here I am getting 2 it is just single user . Help needed in fixing the code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 02:44 PM
You're filtering just the dates on sp_log page. Do you consider yourself a user that also visited that page? You need to do more specific query or GlideRecord query for necessary user. Depends on your business case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2022 02:52 PM
@Community Alums yes I visited page today 2 times but the number of users visited page should be just 1 because I am the same user who visited it two times.