GlideAggregate return wrong value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 12:06 AM
Hi all , Iam trying to get the count based on the query , but in system records its showing count as 534.
but when i run script in background its showing as 543. did i miss anything?
var totalCount = 0;
var count = new GlideAggregate('cmdb_sam_sw_install');
count.addEncodedQuery("discovery_model.u_software_name=c421a3e387e4d21075920d460cbb350b");
count.addAggregate('COUNT');
count.groupBy('installed_on');
count.query();
while (count.next()) {
totalCount = totalCount+1;
gs.info(count.getAggregate("COUNT")+ "--"+count.getValue("installed_on"));
}
gs.info("Total count: " + totalCount);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 02:32 AM
hi @Ravi Gaurav the count is still different
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 02:34 AM
then please tell the filter it mean that some fishy in filter, Can you go to the list view and apply the filter and copy the query and paste it here
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 02:44 AM
this is filter user : discovery_model.u_software_name=c421a3e387e4d21075920d460cbb350b
next is group by installed on
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 08:20 AM
Hi @Ravi Gaurav
.. now i tried to get the count dynamic to all records, but its showing counts only based on the filter ( discovery_model.u_software_name) not considering goupby (installed on.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2024 05:58 AM