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
DivyaReddyDivyaReddy 

very urgent issue.....

hi

 

my requirement is to add the rows & column values like

 

1 2 3  = 6

2 3 1  = 6

1 1 1 =  3

4 6 5

 

so i wrote code like this but will saving

 

 Error: Compile Error: Invalid type: objBudClass at line 19 column 40 . 

 

Can any one help on this issue.

 

Thank q .

 

 

 

public class GroupedQuery123

    public list<AggregateResult> lstAr = new list<AggregateResult>();
   
    public GroupedQuery123()
    {
        lstar = [SELECT Product_Service_Category_Poc__c, Case_Type_Poc__c ,
GROUPING(Product_Service_Category_Poc__c ) p1 , GROUPING(Case_Type_Poc__c ) p2,
COUNT(casenumber) tot1
FROM Case
where CreatedDate = THIS_WEEK and Status = 'open'
GROUP BY CUBE(Product_Service_Category_Poc__c , Case_Type_Poc__c )
order by GROUPING(Product_Service_Category_Poc__c ) , GROUPING(Case_Type_Poc__c )];

    }
    public list<BudClass> getResults(){
        list<BudClass> lstResult = new list<BudClass>();
        for(AggregateResult ar : lstAr){
            BudClass objBudClass = new objBudClass(ar);
            lstResult.add(objBudClass);
        }
        return lstResult;
    }
  
    class BudClass{
        public Double tot1{get;set;}
        public String p1 {get;set;}
        public String p2 {get;set;}
      
        public BudClass(AggregateResult ar){
        tot1 = (Double) ar.get('tot1');
           p1= (Double) ar.get('p1');
            p2= (String) ar.get('p2');
        }
    }

}

 

 

 



Richa KRicha K

Solved below !!

@force.ax1146@force.ax1146

First, this line is generating the error,

 

BudClass objBudClass = new objBudClass(ar);

 

and it should be like BudClass objBudClass = new BudClass(ar);  // correct line.

DivyaReddyDivyaReddy

thank q

 

my controller is saved & i wrote vf page but while i am running my page error is encountered .

 

 

Error : Invalid conversion from runtime type Integer to String.

 

But as u know the values r not integer they r string only so can u help on this issue.

hemantgarghemantgarg

I guess you can make use of Integer.valueOf() method in primitives. for example Integer.valueOf('123') will give you integer 123.