You need to sign in to do that
Don't have an account?
Justin Ruck
VF Table Showing Only Headers without Values
I have a table in a VisualForce page that is only showing headers. I checked my controller, and there are values in the Sandbox for my query. Is there anything you can see as to why the table isn't pulling in values?
VF Page:
APEX Class
VF Page:
<apex:page controller="HomeGamificationController"> <apex:pageBlock title="Rank"> <apex:pageBlockTable value="{!Top10List}" var="ar" rows="10" width="50%"> <apex:column headerValue="Owner"> <apex:outputText value="{!OwnedBy}"/> </apex:column> <apex:column headervalue="Closed Amount"> <apex:outputText value="{!Amount}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:page>
APEX Class
public class HomeGamificationController { public list<AggregateResult> lstAR = new list<AggregateResult>(); public list<oppClass> Top10List { get; private set; } private User currentUser { get; private set; } public String OwnedBy { get; private set; } public Double Amount { get; private set; } public HomeGamificationController() { //pulling the current user information this.currentUser = Database.query ('select Branch__c, BranchShort__c, RegionSGI__c, Country, ReportLevel__c, X2015_Collections_Budget__c from User where Id = \'' + UserInfo.getUserId() + '\' limit 1'); //there are many different levels of users, with some seeing different data if (this.currentUser.ReportLevel__c == 'Territory Manager') { lstAR = [select Owned_By__c, sum(Amount) amt from Opportunity where Opportunity.Region_SGI__c = :this.currentUser.RegionSGI__c and Close_Date_Current_Quarter__c = True and StageName = 'Closed Won' group by Owned_By__c ORDER BY sum(Amount) ASC LIMIT 10]; for (AggregateResult ar : lstAR) System.debug(ar.get('owner')+'-'+ar.get('amt')); } else if (this.currentUser.ReportLevel__c == 'Market Manager') { lstAR = [select Owned_By__c, sum(Amount) amt from Opportunity where Opportunity.Region_SGI__c = :this.currentUser.RegionSGI__c and Close_Date_Current_Quarter__c = True and StageName = 'Closed Won' group by Owned_By__c ORDER BY sum(Amount) ASC LIMIT 10]; for (AggregateResult ar : lstAR) System.debug(ar.get('owner')+'-'+ar.get('amt')); } else if (this.currentUser.ReportLevel__c == 'Sales Director') { lstAR = [select Owned_By__c, sum(Amount) amt from Opportunity where Opportunity.Region_SGI__c = :this.currentUser.RegionSGI__c and Close_Date_Current_Quarter__c = True and StageName = 'Closed Won' group by Owned_By__c ORDER BY sum(Amount) ASC LIMIT 10]; for (AggregateResult ar : lstAR) System.debug(ar.get('owner')+'-'+ar.get('amt')); } else if (this.currentUser.ReportLevel__c == 'VP of Sales') { lstAR = [select Owned_By__c owner, sum(Amount) amt from Opportunity where Opportunity.Owner.Country = :this.currentUser.Country and Close_Date_Current_Quarter__c = True and StageName = 'Closed Won' group by Owned_By__c ORDER BY sum(Amount) ASC LIMIT 10]; for (AggregateResult ar : lstAR) System.debug(ar.get('owner')+'-'+ar.get('amt')); } else if (this.currentUser.ReportLevel__c == 'Corporate') { lstAR = [select Owned_By__c owner, sum(Amount) amt from Opportunity where Close_Date_Current_Quarter__c = True and StageName = 'Closed Won' group by Owned_By__c ORDER BY sum(Amount) ASC LIMIT 10]; for (AggregateResult ar : lstAR) System.debug(ar.get('owner')+'-'+ar.get('amt')); } List<oppClass> Top10List = new List<oppClass>(); for (AggregateResult ar : lstAR) { Top10List.add(new oppClass(ar)); } return; } //wrapper public class oppClass { String OwnedBy { get; private set; } public Double Amount { get; private set; } public oppClass(AggregateResult ar) { OwnedBy = String.valueOf(ar.get('owner')); Amount = Double.valueOf(ar.get('amt')); } } }
To:
All Answers
<apex:outputText value="{!ar.OwnedBy}"/>
<apex:outputText value="{!ar.Amount}"/>
I tried that, but now I get an error message:
Unknown property 'HomeGamificationController.oppClass.OwnedBy'
public String OwnedBy { get; private set; }
To: