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

Show on VF page results of the 3 SOQL requests

I need to show on the VF page (table) results of the 3 SOQL requests:

I have 2 objects: Users and related SyncLog__c

I need to see on the table
First column: Users list
Second column: Is there records created before 10 AM YES/NO
Third column: Is there records created after 6 PM YES/NO

Raj R.Raj R.
For the second and third column, is that criteria for today only or should that include all time? For example, do you need all user records created before 10AM since 2 years ago or do you need all user records created before 10AM today?

With out more details,
Datetime todayBeforeTen = Date.Today();
todayBeforeTen = todayBeforeTen.addHours(10);

Datetime todayAfterSix = Date.Today();
todayAfterSix = todayAfterSix.addHours(18);

// Create maps to make it easier to fetch
Map<Id,User> usersBeforeTen = new Map<Id,User>();
Map<Id, User> usersAfterSix = new Map<Id,User>();

for(User usr : [Select Name, CreatedDate
                From User]) {
  if(usr.CreatedDate < todayBeforeTen) {
    usersBeforeTen.put(, usr);
  else if(usr.CreatedDate > todayAfterSix) {
    usersAfterSix.put(, usr);
}//end for
Now that we have the maps, you can use the following to print them as needed. 
<apex:pageblocktable value=”{!MapName} var=”key”>

<apex:column value=”{!MapName[key].< Enter value regarding this key here>}”/>


Other resources:
  • (using <apex:repeat>)