The CreatorCon Call for Content is officially open! Get started here.

Requirement to show top three records from event table based on some field value for unique CI's

Community Alums
Not applicable

Dear Community,

I have a requirement to show top three records based on the message value(can be seen in screen-shot) so we need to orderBy message value and for unique Configuration Item(can be seen in screen-shot)  so we need to groupBy cmdb_ci,  I tried this but not able to get the result. Please find the below Screen-shot and Code for the same:

First try:
 

var ga = new GlideAggregate('em_event');
ga.addAggregate('COUNT');
ga.orderByDesc('message_key');
ga.groupBy('cmdb_ci');
ga.query();
while(ga.next()) {

gs.print() // here I need to print unique CI name having top message_key value but currently it is not working

}

 

Shivam228701507_0-1718795888115.png

 

0 REPLIES 0