Example: Count

This query counts all open incidents for which your department is the service owner of the affected service:

Note For better performance, this example use doCount in the query instead of looping on the record list.

var file = new SCFile("probsummary");
var sql = "select p.* from probsummary p LEFT OUTER JOIN device d ON (p.affected.item=d.logical.name) where d.owner=$lo.dept and p.flag=true";
var count = file.doCount(sql);
print(count);