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
Vivekh88Vivekh88 

Month wise row in VF page

Hi,

I have a requirement where i have to populate the number of logins made by the users rowwise and show them in  VF page,

                              Profile     August 2016 Logins      July2016logins           June2016Logins
Vivek                     Admin           15                                   15                           11
Rajesh                   Business       10                                   12                           22

I am using LoginHistory object for querying all data's.
Can the month values be populated rowwise?

Thanks
Vivek
RAM AnisettiRAM Anisetti
Hi Vivek,

try the below query,
List<aggregateResult> results=[Select Count(ID), CALENDAR_MONTH(LoginTime)start,userid From LoginHistory GROUP BY userid,CALENDAR_MONTH(LoginTime)];

system.debug('----'+results);

for (AggregateResult ar : results)  {
  System.debug('User id--'+ar.get('userid')+'-Month-'+ar.get('start')+'-Count-'+ar.get('expr0'));
}