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
Venkateswarlu BVenkateswarlu B 

I want to display Account and Contact records based on their created dates in a list. If on one date account not created it should be blank and if contact created on that date that contact should be visible.I need all account and contact created dates.

AB TestAB Test

 If i am able to recollect properly , Your usecase is to show all dates and if account is created on any specific date you will display the account is visible and contact is created then contact is displayed. 

  For this i think it would help if you follow below approach : 
  1. Get a list of all dates which you need to display or traverse on. Below is the code snippet for the similar stuff which would get upcoming 100 days from today's date.
    Date todaysDate = System.Today();
    system.debug('100 dates from today ... ');
    for(Integer i = 1; i<= 100 ; i++){
    	system.debug('Day '+i+' ==>'+todaysDate.addDays(i));
  2. Secondly you can create following Map<Date,List<Object>> for Account and contact which would hold all the records of account and contact with respect to the CreatedDate.
  3. Now you can just traverse the Date list created in step1 and poppulate the values from the above created Map in step 2 and display the Accounts or Contacts created on that date and else you will show blank.

Hope this Helps.
Please mark the answer as best answer or like it if it helps :)