You need to sign in to do that
Don't have an account?
Mateo Alcauter
display an aggregate result on visualforce page
How can i display the results from this list on a visualforce page?
Controller:
public List<AggregateResult> BadgeList
{
get
{
List<AggregateResult> badges= [SELECT RecipientId, count(id) From WorkBadge GROUP BY RecipientId ORDER BY count(id) DESC LIMIT 5];
return badges;
}
set;
}
Visualforce page:
<apex:pageBlock>
<apex:pageBlockTable value="{!BadgeList}" var="badges" title="My Badges" columns="2" align="center" styleClass="table table-striped">
<apex:facet name="header">My Badges</apex:facet>
<apex:column value="{!badges['RecipientId']}"/>
<apex:column value="{!badges['count(id)']}"/>
</apex:pageBlockTable>
</apex:pageBlock>
Error message when i go to the visualforce page:
Unknown property 'AggregateResult.count(id)'
Error is in expression '{!badges['count(id)']}' in component <apex:column> in page companyhome
Error evaluating dynamic reference 'count(id)'
Controller:
public List<AggregateResult> BadgeList
{
get
{
List<AggregateResult> badges= [SELECT RecipientId, count(id) From WorkBadge GROUP BY RecipientId ORDER BY count(id) DESC LIMIT 5];
return badges;
}
set;
}
Visualforce page:
<apex:pageBlock>
<apex:pageBlockTable value="{!BadgeList}" var="badges" title="My Badges" columns="2" align="center" styleClass="table table-striped">
<apex:facet name="header">My Badges</apex:facet>
<apex:column value="{!badges['RecipientId']}"/>
<apex:column value="{!badges['count(id)']}"/>
</apex:pageBlockTable>
</apex:pageBlock>
Error message when i go to the visualforce page:
Unknown property 'AggregateResult.count(id)'
Error is in expression '{!badges['count(id)']}' in component <apex:column> in page companyhome
Error evaluating dynamic reference 'count(id)'
Use this code .
All Answers
Use this code .
One more question. How do i get the name of the person? RecipientId.Name doesn't work. neither does RecipientId__r.Name