+ Start a Discussion
sekharasekhara 

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= (String) ar.get('p1');
            p2= (String) ar.get('p2');
        }
    }
}
 
SrikanthKuruvaSrikanthKuruva

error is in this line

BudClass objBudClass = new objBudClass(ar);

 

it should be (remove obj)

BudClass objBudClass = new BudClass(ar);

sekharasekhara

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

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.

 

SrikanthKuruvaSrikanthKuruva

try changing the lines

p1= (String) ar.get('p1');
p2= (String) ar.get('p2');

 to

p1= String.valueOf(ar.get('p1'));
p2= String.valueOf(ar.get('p2'));

 

DivyaReddyDivyaReddy

Error is gone but values are coming in integer only.

SrikanthKuruvaSrikanthKuruva

so you want to show string values on vf page but you are getting inetger values on vf page. is that what you are looking for.

sekharasekhara

ya exactly

 

that what i want

SrikanthKuruvaSrikanthKuruva

can you post the vf code

sekharasekhara
This is the code i used:
<apex:page controller="GroupedQuery123">
<table border = '1'>
<apex:repeat value="{!results}" var="a">
<tr>
<td>{!a.p1}</td>
<td>{!a.p2}</td>
<td>{!floor(a.tot1)}</td>
</tr>
</apex:repeat>
</table>
</apex:page>
SrikanthKuruvaSrikanthKuruva

i dont find any coding mistakes. say for example ar.get('p1') value is 25 then what are you expecting to be shown on the vf page?

sekharasekhara

Here 

p1 = Product_Service_Category_Poc__c 

p2 = Case_Type_Poc__c 

tot1 = count (Casenumber)

 

 

my requirement is :

 

abc                 ----------------------> p1

TVA1236

wocs 1236

 

246 

:
:
:
:

p2