function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ShravanKumarBagamShravanKumarBagam 

Aggregate function

hi,

 

    Using count function ,how can i get values of count() or count(fieldname)...

SFDC_EvolveSFDC_Evolve

I did not get the Count(fieldName).......

 

If you want the record Count for the Specific fields .  You can Query like this . . 

 

[select Count() from the Object where FieldName__c ! = null];

 

 

Thanks 

SFDC_Evolve

kiranmutturukiranmutturu

AggregateResult[] groupedResults= [SELECT count(Amount) FROM Opportunity];
Object avgAmount = groupedResults[0].get('expr0');

integer icount = (integer) avgAmount;

 

remember : You can't use COUNT() with an ORDER BY clause also You can't use COUNT() with a GROUP BY 

 

but u can make use when you can use a GROUP BY clause with COUNT(fieldName)