+ Start a Discussion
Hieu VuongHieu Vuong 

Need help add a column to a visual force page table with combine two list

Hi, 

I need help combining two list and show it on a table in SalesForce. 

Below is my apex controller class and my apex page and screenshot of my visual force page. 

Apex controller 
class 
 
public with sharing class IITDeanDashBoardController {
   public List<AggregateResult> BadgeList {
       get
       {
           List<AggregateResult> badges= [
                SELECT TargetX_SRMb__College__c
                , Department__c
                , IIT_Program__r.Name ccc
                   , count(Id) bbb
                FROM TargetX_SRMb__Application__c
                WHERE TargetX_SRMb__College__c = 'Chicago-Kent College of Law' 
                   And TargetX_SRMb__Start_Term_Year__c = '2019'
                And TargetX_SRMb__Start_Term__c = 'Fall'
                And TargetX_SRMb__Level__c = 'Graduate'
                   And TargetX_App__Is_Test_Record__c = False
                And TargetX_SRMb__Application_Submit_Date__c != Null 
                GROUP BY IIT_Program__r.Name, Department__c, TargetX_SRMb__College__c
                Order By IIT_Program__r.Name
            ];     
           return badges;
       }
       set;       
    }
    
   public List<AggregateResult> InQueueDecision {
       get
       {
           List<AggregateResult> QueueDecisions= [
                SELECT IIT_Program__r.Name ccc,
                count(Id) InDecision
                FROM TargetX_SRMb__Application__c
                WHERE TargetX_SRMb__College__c = 'Chicago-Kent College of Law' 
                   And TargetX_SRMb__Start_Term_Year__c = '2019'
                And TargetX_SRMb__Start_Term__c = 'Fall'
                And TargetX_SRMb__Level__c = 'Graduate'
                   And TargetX_App__Is_Test_Record__c = False
                And TargetX_SRMb__Application_Submit_Date__c != Null 
                And IIT_Sent_For_Faculty_Decision__c = Null
                And TargetX_SRMb__Application_Decision__c = Null
                GROUP BY IIT_Program__r.Name, Department__c, TargetX_SRMb__College__c
            ];                 
           return QueueDecisions;
       }
       set;       
    }
     
}

Apex Visual Force Page
<apex:page controller="IITDeanDashBoardController" >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!BadgeList}" var="a" title="My Badges" columns="4" align="center"  styleClass="table table-striped">
            <apex:facet name="header">Chicago-Kent College of Law DashBoard </apex:facet> 
            <apex:column > 
            <apex:facet name="header">College</apex:facet>
            {!a['TargetX_SRMb__College__c']}</apex:column>
            <apex:column > <apex:facet name="header">Department</apex:facet>
            {!a['Department__c']}</apex:column>
             <apex:column > <apex:facet name="header">Program</apex:facet>
            {!a['ccc']}</apex:column>
             <apex:column > <apex:facet name="header">Total Apps</apex:facet>
            {!a['bbb']}</apex:column>
        </apex:pageBlockTable>
      </apex:pageBlock>    
    
    
        <apex:pageBlock >
        <apex:pageBlockTable value="{!InQueueDecision}" var="n" title="InqueueProcess" columns="4" align="center"  styleClass="table table-striped">
            <apex:facet name="header">Chicago-Kent College of Law DashBoard </apex:facet> 
            <apex:column > 
            <apex:facet name="header">Program</apex:facet>
            {!n['ccc']}</apex:column>
            <apex:column > <apex:facet name="header">Number of app status InProcess</apex:facet>
            {!n['InDecision']}</apex:column>
        </apex:pageBlockTable>
      </apex:pageBlock>   
  </apex:page>

Actual Page looks
User-added image 



 
Lokesh KumarLokesh Kumar
Please use the wrapper class to combine the two list.
Hieu VuongHieu Vuong
Hi Lokesh,

Can you show me how to do that?