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
Raja Sharma 7Raja Sharma 7 

System.UnexpectedException: field 'Full_Material_Name__c' can not be grouped in a query call

When I use Full_Material_Name__c field (Type: Long Text ) then i got error "System.UnexpectedException: field 'Full_Material_Name__c' can not be grouped in a query call " for that code.
Apex Class:
Public Controller(){
    AggregateResult[] results = [SELECT Full_Material_Name__c, SUM(Total_Price__c) Total, SUM(Total_Unit_Price__c) Totalu, Count(Id)         Quantity FROM Order_Line_Item__c WHERE Order_ID__c =: order.Id  GROUP BY Full_Material_Name__c];
          Summaries = new List<Summary>();
      
         for(AggregateResult ar : results) {
            Summaries.add(new Summary(ar));
        }
   }   

    // wrapper class to hold aggregate data
    public class Summary {
        public Integer Quantity {get; private set; }
       //public String Name {get; private set; }
        public Integer Total {get; private set;}
        public Integer Totalu {get; private set;}
        public String FullName { get; private set; }

        public Summary(AggregateResult ar) {
            Quantity = (Integer) ar.get('Quantity');
         //   Name = (String)ar.get('Master_Material_Lookup__c');
            Total = Integer.valueOf(ar.get('Total'));
            Totalu = Integer.valueOf(ar.get('Totalu'));
            FullName = String.valueOf(ar.get('Full_Material_Name__c'));
         }
    }

when i use lookup field that code working properly when i use Text field then that gives me the following error.
 
Raja Sharma 7Raja Sharma 7
Hi Sir,

Thank you for the reply.

I have already worked on following links but I am not able to group by text area long field.

Thanks 
Raja