Skip to main content
Hello!

Please bear with me, I am pretty new to Visualforce development. 

I am trying to display two PageBlock tables containing data from two separate custom objects on a visualforce page. 

I have created a controller: 

 

public class GUIDataController{

public List<Buyer_Performance__c> listOfBP {get; set;}

public List<Buyer__c> listOfBuyer {get; set;}

public Buyer_Performance__c BP {get;set;}

public Buyer__c Buyer {get;set;}

public GUIDataController() {

listOfBP = [Select id, name from Buyer_Performance__c];

}

}

And have created the two table: 

 

<apex:page controller="GUIDataController">

<apex:pageBlock title="Top Performers This Week">

<apex:pageBlockTable value="{!BP}" var="bp">

<apex:column value="{!bp.Name}"/>

<apex:column value="{!bp.Sold_Calls_this_Week__c}"/>

</apex:pageBlockTable>

</apex:pageBlock>

<apex:pageBlock title="Underfunded Buyers">

<apex:pageBlockTable value="{!Buyer}" var="by">

<apex:column value="{!by.Name}"/>

<apex:column value="{!by.Current_Balance__c}"/>

</apex:pageBlockTable>

</apex:pageBlock>

</apex:page>

But the output is empty.  

I am not sure where to turn, and frankly am stumped!  What element am I missing?
2 Antworten
  1. 18. Feb. 2015, 16:26
    Yes, it's syntax related. Your VF page is trying to iterate over a single object (one that you are not setting in your apex class even).  Try changing your VF to the following, using the list of buyer performances (listOfBP).  If you have any Buyer_Performance__c records, they should display:

     

    <apex:page controller="GUIDataController">

    <apex:pageBlock title="Top Performers This Week">

    <apex:pageBlockTable value="{!listOfBP}" var="bp">

    <apex:column value="{!bp.Name}"/>

    <apex:column value="{!bp.Sold_Calls_this_Week__c}"/>

    </apex:pageBlockTable>

    </apex:pageBlock>

    </apex:page>

    Also, I noticed you're trying to display two different lists. You'll want to create / populate those both in your controller as well.  
0/9000