difference between getRowCount VS getaggregate('COUNT')

Sagar_pawar
Tera Contributor

Hello All,

I do not understand what the difference is between getRowCount and getAggregateCount. can anyone please guide me on this?

Thank You.

1 ACCEPTED SOLUTION

Pavankumar_1
Mega Patron

Hi @Sagar_pawar ,

getRowCount - Used to get the Row count but it is not recommanded for any aggregate operation use GlideAggregate.

GlideAggregate
GlideAggregate used to do database aggregation operations(Count, Min, max, sum, AVG, etc..)

Refer below link for GlideAggregate methods with examples.

https://developer.servicenow.com/dev.do#!/reference/api/tokyo/server_legacy/c_GlideAggregateAPI#r_Gl...

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

View solution in original post

6 REPLIES 6

Pavankumar_1
Mega Patron

Hi @Sagar_pawar ,

getRowCount - Used to get the Row count but it is not recommanded for any aggregate operation use GlideAggregate.

GlideAggregate
GlideAggregate used to do database aggregation operations(Count, Min, max, sum, AVG, etc..)

Refer below link for GlideAggregate methods with examples.

https://developer.servicenow.com/dev.do#!/reference/api/tokyo/server_legacy/c_GlideAggregateAPI#r_Gl...

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Vaibhav
Mega Guru

Hello Abhi,

getRowCount() method from GlideRecord and getAggregate('COUNT') method is from GlideAggregate class.

 

For more details you can go through below document:

Difference between GlideRecord() and GlideAggregate()

 

Please mark the answer correct/helpful accordingly.

 

Regards,

Vaibhav