• #9450
    Salesforce | Ajit Ajit #399
    Forcetalks

    Formula field in Aggregate query

    Can any body suggest me how can i use the formula field in a aggregate soql query because when i am using the field it is throwing error that this field can’t be grouped or aggregated

    like

    select count(id), formula__c from Object__c group by formula__c

     

    #9451
    Salesforce | Suyash Suyash #400
    Forcetalks

    Hello Ajit,

    Formula fields are not “groupable” i.e they are not usable in the GROUP BY clause of a SOQL query.

    #9454
    Salesforce | Ravi Ravi #403
    Forcetalks

    Hi Ajit,
    Formula Fields cannot be used with the group by clause in SOQL query
    You can check whether a field is “groupable” or not using DescribeFieldResult.
    Example:
    Schema.DescribeFieldResult resultObject= Object__c.formula__c.getDescribe();
    if(resultObject.groupable == true){
    formula__c is groupable
    }else
    formula__c is not groupable

    • This reply was modified 2 years, 7 months ago by Salesforce | Ravi Ravi.
    #33272
    Salesforce | Parul Parul #2
    Forcetalks

    Hi Ajit

    To Check whether any field is “groupable” or not,Please follow the below procedure

    Schema.DescribeFieldResult fieldDescribe = ObjectName.FieldName.getDescribe();

    if(fieldDescribe.groupable == true){

    Then Our Field is Groupable

    }

    Thanks

     

     

    #51923
     William #15
    Forcetalks

    Formula fields are not “groupable” – that is, they are not usable in the GROUP BY clause of a SOQL query. There is limitation like Formula fields can’t use in the group by Clause.

    #52360
    Forcetalks

    Hi

    Formula fields are not groupable  they are not usable in the GROUP BY clause of a SOQL query.

Viewing 6 posts - 1 through 6 (of 6 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2018 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?