You need to sign in to do that
Don't have an account?
AggregateResult in Expression
Is this possible (with the correct syntax)?
I know you can use Count() in an expression like this (according to this jeff douglass post (http://blog.jeffdouglas.com/2010/04/12/using-aggregateresult-in-salesforce-com-soql/)) because it returns the number of rows, not an object. But can I cast into an integer or something else?
if(AggregateResult results = [SELECT SUM(X2_1_a_Total_of_jobs_Year_2__c) FROM Form__c] > results.size(0)){ System.debug('sum of year 2 greater than 0'); }else{ system.debug('sum of year 2 NOT greater than 0'); }
I know you can use Count() in an expression like this (according to this jeff douglass post (http://blog.jeffdouglas.com/2010/04/12/using-aggregateresult-in-salesforce-com-soql/)) because it returns the number of rows, not an object. But can I cast into an integer or something else?
All Answers
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_agg_fns.htm