Scoped GlideAggregate - setGroup(Boolean b)

Sets whether the results are to be grouped.

Table 1. Parameters
Name Type Description
b Boolean When true the results are grouped.
Table 2. Returns
Type Description
void

var ga = new GlideAggregate('incident');
ga.addAggregate('COUNT', 'category');
 
ga.setGroup(true);
ga.groupBy("category");
 
ga.query();
 
while(ga.next()) {
  gs.info('Category ' + ga.category + ' ' + ga.getAggregate('COUNT', 'category'));
  }

Output:

Category database 2
Category hardware 7
Category inquiry 18
Category network 5
Category request 5
Category software 11