• 122
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

Hi,

 

Below is my visual force page and controller.

 

 

<apex:page standardController="Account"  extensions="MyPolicy"  >
  <apex:pageBlock title="Channel Performance Report" >
        <apex:pageBlockTable value="{!Results}" var="item" >
                  <apex:column value="{!item.Total}"  headerValue="Premium"/>

         
                                          </apex:pageBlockTable>  
                                                    </apex:pageBlock>
</apex:page>

 

 

 

 

 

public MyPolicy(ApexPages.StandardController controller) {
  }


public list<AggregateResult> AccountPolicy = new list<AggregateResult>();

 public MyPolicy(){

AccountPolicy= [SELECT Channel_Name__r.Channel_Id__c,COUNT(Sum_Of_Premium__c) Total from Policy__c GROUP BY Channel_Name__r.Channel_Id__c];

}
  public list<OppClass> getResults()  
{  
list<OppClass> lstResult = new list<OppClass>();  
for (AggregateResult ar: AccountPolicy)  
{  
oppClass objOppClass = new oppClass(ar);  
lstResult.add(objOppClass);  
}  
return lstResult;  
}  
 
class oppClass  
{  
public Integer Total  
{ get;set; }  
 
 
public oppClass(AggregateResult ar)  
{  
Total = (Integer)ar.get('Total');
 System.debug('total' + ar.get('Total'));
  
}  
}  
}

 

 

from the above code, i am trying to display total value on to the page. but no value  is displaying.

Please help me in achieving this. 

 

 

  • April 13, 2012
  • Like
  • 0