/ Published in: Other
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public List<Recommendation> getRecipeEightTopPosters() { List<AggregateResult> results = [ SELECT ParentId pid, Parent.Name pname, COUNT(id) fcount FROM UserFeed WHERE Type='UserStatus' AND CreatedDate = THIS_WEEK GROUP BY Parent.Name, ParentId ORDER BY Count(id) DESC LIMIT 10]; List<Recommendation> top = new List<Recommendation>(); Recommendation r = null; for (AggregateResult ar : results) { r = new Recommendation(); r.count = ar.get('fcount') + ''; r.name = ar.get('pname')+''; r.entityid = ar.get('pid')+''; top.add(r); } return top; }