function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Display number of record entries by user

I have a visualforce page that displays user contribution by CreatedById. Here is my controller code:
public List<AggregateResult> getTop6Contributors()
        return [SELECT CreatedById, CreatedBy.Name Name  FROM Idea group by CreatedById, CreatedBy.Name order by count(CreatedById) desc limit 6];
How do I display on my page the number of records a user has submitted?

Best Answer chosen by Btuitasi1
You'll need to utilize the get method of individual list resources and process that into a standard list.

Soemthing like this:
public class wrapperObj{
  Id createdby {get;set;}
  String name {get; set;}

List<wrapperObj> contributors = new List<wrapperObj>();

for(AggregateResult i : getTop6Contributors()){
  WrapperObj x = new WrapperObj();
  x.createdBy = i.get('exp0'); = i.get('Name');
Then on your visualforce page: 

    <apex:repeat value="{!contributors}" var="x" id="repeator">

        <apex:outputText value="{!x.Name}" id="theName"/><br/>