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
sekharasekhara 

Small issue on sum

hi

i am unable to sum the values in vf page can any one help on this.

 

My controller :

 

public class AAA_Cases
{
 public  AAA_Cases(ApexPages.StandardController controller)
    {  }
    public  Case[] c;
    
 public String[] states {get;set;}
  public String[] state1 {get;set;}
 public list<AggregateResult> lstAR = new list<AggregateResult>();
 public list<AggregateResult> lstAR1 = new list<AggregateResult>();
 /*
 Date currentdate = system.today();
  Date cr = currentdate+7;
  */
 public  AAA_Cases()
{
c = [select Product_Service_Category_Poc__c ,Case_Type_Poc__c from case where CreatedDate = THIS_WEEK ];// where CaseNumber = '00626808' ];
lstar = [Select Count(CaseNumber) tot1,Product_Service_Category_Poc__c p1,Case_Type_Poc__c p2 from  Case where CreatedDate = THIS_WEEK and Status = 'Open' group by Product_Service_Category_Poc__c,Case_Type_Poc__c];
//lstar = [Select Grouping(Product_Service_Category_Poc__c) p1,Case_Type_Poc__c p2, Count(CaseNumber) tot1 from  Case where CreatedDate = THIS_WEEK and Status = 'Open' group by Case_Type_Poc__c];
lstar1 = [Select Count(CaseNumber) tot , Product_Service_Category_Poc__c p,Case_Type_Poc__c p0 from  Case where CreatedDate = THIS_WEEK and Status = 'Closed' group by Product_Service_Category_Poc__c,Case_Type_Poc__c ];
Set<String> stateSet = new Set<String>();
      for(Case a : c)
     stateSet.add(a.Product_Service_Category_Poc__c); 
   states = new String[stateSet.size()];
    Integer i = 0;
    for (String state : stateSet) { 
      states[i] = state;
      i++;
    }
 states.sort();
 
 /*==========================*/
 
 Set<String> stateSet1 = new Set<String>();
      for(Case a1 : c)
     stateSet1.add(a1.Case_Type_Poc__c); 
   state1 = new String[stateSet1.size()];
    Integer j = 0;
    for (String state : stateSet1) { 
      state1[j] = state;
      j++;
    }
 state1.sort();
 /*==========================*/
 
}
 public String getname() {
return 'AAA_Cases';
}
public Case[] getc() {
return c;
}
 public list<Opp> getResult()  
{  
list<Opp> lstResult = new list<Opp>();  
for (AggregateResult ar: lstAR)  
{  
opp objOpp= new opp(ar);  
lstResult.add(objOpp);  
}  
return lstResult;  
}  
  
class opp
{  
public Double Tot1
{ get;set; } 
//public Double i{ get;set; } 
public string p1
{ get;set; } 
public string p2
{ get;set; }   
  
public opp(AggregateResult ar)  
{  
Tot1 = (Double)ar.get('Tot1');
//i = (Double)ar.get('i');
p1 = (string)ar.get('p1');
p2 = (string)ar.get('p2');
     }
   
 }
 /*============================= */ 
 public list<Opp1> getResult1()  
{  
list<Opp1> lstResult1 = new list<Opp1>();  
for (AggregateResult ar: lstAR1)  
{  
opp1 objOpp1= new opp1(ar);  
lstResult1.add(objOpp1);  
}  
return lstResult1;  
}  
  
class opp1
{  
public Double Tot
{ get;set; } 
public string p
{ get;set; } 
public string p0
{ get;set; }   
  
public opp1(AggregateResult ar)  
{  
Tot = (Double)ar.get('Tot');
p = (string)ar.get('p');
p0 = (string)ar.get('p0');
     }
   
 }
 /* =============================*/
 }
Vf Page :
<apex:page controller="AAA_Cases"  showHeader="false" sidebar="false">
<apex:form>
<!--
<apex:outputpanel id="counter">
<apex:outputText value="Click Me!: {!count}"/>
apex:actionSupport event="onclick"
action="{!incrementCounter}"
rerender="counter" status="counterStatus"/>
<apex:actionStatus id="counterStatus"
startText=" (incrementing...)"
stopText=" (done)"/>
</apex:outputpanel> -->
<html>
<br/><br/> 
<tr> <td >
        <font style="font-size: 20px;" color="#000000" face="Calibri"><b>Open Case</b></font></td></tr> 
        <br/> <br/>
<table border='1' cellpadding='0' cellspacing='0'>
<td width='100px'> </td>
<apex:repeat value="{!States}" var="doc">
      
      <td width='100px' align = 'Center'>{!doc}</td>
        </apex:repeat>
           <apex:repeat value="{!State1}" var="time">
    <tr>
     
         <td width='100px'><b><center>{!time}  </center></b></td> 
             <apex:repeat value="{!States}" var="doc">
           
          
         <td width='150px'>
<table>
             <apex:repeat value="{!result}" var="app"> 
              
             <apex:outputPanel rendered="{!IF((app.p1=doc) && (app.p2 = time),true,false)}"><center>{!floor(app.tot1)}</center>
              
         <!--  
<apex:outputpanel id="counter">
<apex:outputText value="Calc!: {!count}"/>
</apex:outputpanel>
 
     
    <tr>
          <td width='100px' align = 'center'>{!floor(app.tot1)}
         </td>
    </tr>
            -->
                   
             </apex:outputPanel> 
  
             </apex:repeat> 
</table>
        </td>
            </apex:repeat>
    </tr>
            </apex:repeat>
</table>
<!-- ------------------------------------------  Closed Cases --------------------------------------- -->
<br/><br/> 
<tr> <td >
        <font style="font-size: 20px;" color="#000000" face="Calibri"><b>Closed Case</b></font></td></tr> 
        <br/> <br/>
<table border='1' cellpadding='0' cellspacing='0'>
<td width='100px'>  </td>
<apex:repeat value="{!States}" var="doc">
     <td width='100px' align = 'center'>{!doc}</td>
        </apex:repeat>
        
           <apex:repeat value="{!State1}" var="time">
    <tr>
     
         <td width='100px'><b><center>{!time}  </center></b></td> 
             <apex:repeat value="{!States}" var="doc">
          
         <td width='150px'>
<table>
             <apex:repeat value="{!result1}" var="ap"> 
              
             <apex:outputPanel rendered="{!IF((ap.p=doc) && (ap.p0 = time) ,true,false)}"><center>{!floor(ap.tot)}</center>
             <!--
           
    <tr>
          <td width='100px' align = 'center'>{!floor(ap.tot)}
         </td>
    </tr>
            -->
            
                   
             </apex:outputPanel> 
  
             </apex:repeat> 
</table>
        </td>
            </apex:repeat>
    </tr>
            </apex:repeat>
</table>
 
 
</html>
</apex:form>
</apex:page>
TheSwamiTheSwami

This code is a bit hard to follow - can you provide a simpler example or point out where the problem is?

sekharasekhara

Can u post hw the Group By Cube is used like controller & vf page.