+ Start a Discussion
sridharbarlasridharbarla 

How to Display data in visualforce page

Hai  i am new to visual force page

 

How to disaply below query data in visual force page

 

AggregateResult[] oppResult= [select SUM(amount),LeadingConverteamUnit__c from Opportunity where RECORDTYPEID = '012200000001ReyAAE'
 GROUP BY LeadingConverteamUnit__c ];

so now i need to display this groupedResults in table or grid manner how to do this

 --------------------------------------------

| leading unit                   |    amount      |

---------------------------------------------

|sample1                        | 10000           |

|-------------------------------------------

|sample opp2                  | 200000        | 
|-------------------------------------------

|sample Opp3                 | 300000000   |

---------------------------------------------

 

 

gv007gv007

To display data like table wise format you need to <apex:pageBlock> or <apex:dataTable> componets works like for loop and inside taht u need use <apex:colum> tag

 

sample code

 

<apex:page controller ="xyz">

<apex:form>

<apex:datatable>

<apex:column>

{!mergefield}

</apex:colum>

</apex:dataTable>

</apex:form>

</apex:page>

 

using the controller write the query in a method and call it as mergefield .Please see the force.com cookbook you will get lot of sample code.It was in the documentation
check force.com site.

<

sridharbarlasridharbarla

Hi

My question is how to display AggregateResult value in table manner

 if it is a standard object like opportunity ,account , i can directly return list

 

 getOppList()   method data i am able to diasply

but how to diasplay  getFlowBusiness()  data

 

if possible please provide code for this

 

public class GetOpportunityDetails{
 


   List<Opportunity> oppThirdList; 
    public List<Opportunity> getOppList() 
    {
     if(oppThirdList== null)
     {
       oppThirdList= [select name,amount,StageName,LeadingConverteamUnit__c,
       MarketSegment__c,ThirdPartyInternal__c,FlowBusiness__c
       from Opportunity where RECORDTYPEID = '012200000001RetAAE' 
       and FlowBusiness__c ='No'
       order by name];
     }
     return oppThirdList;
    } 
             
    
   public void getFlowBusiness()
   {
      AggregateResult[] groupedResults = [select SUM(amount) amt,LeadingConverteamUnit__c from Opportunity where RECORDTYPEID = '012200000001ReyAAE'
      GROUP BY LeadingConverteamUnit__c ];
      
       for (AggregateResult ar: groupedResults) 
      { 

        }
        }

}

 

 

 

 

 

 

<apex:page controller="GetOpportunityDetails" id="thePage">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!oppList}" var="oppThird" id="opp_Third_table">
<apex:column headerValue="Opportunity Name">
<apex:outputLabel value="{!oppThird.Name}"/>
</apex:column>
<apex:column headerValue="Opportunity Amount">
<apex:outputLabel value="{!oppThird.amount}"/>
</apex:column>

<apex:column headerValue="StageName">
<apex:outputLabel value="{!oppThird.StageName}"/>
</apex:column>

<apex:column headerValue="Leading Converteam Unit">
<apex:outputLabel value="{!oppThird.LeadingConverteamUnit__c}"/>
</apex:column>


<apex:column headerValue="Market Segment">
<apex:outputLabel value="{!oppThird.MarketSegment__c}"/>
</apex:column>


<apex:column headerValue="ThirdParty or Internal ">
<apex:outputLabel value="{!oppThird.ThirdPartyInternal__c}"/>
</apex:column>

<apex:column headerValue="Flow Business">
<apex:outputLabel value="{!oppThird.FlowBusiness__c}"/>
</apex:column>


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

 



</apex:form>
</apex:page>
 

 

JumboJumbo

HI,

 

your problem has been resolved? i am in the same case.

 

Thank's for any suggestion.