Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6596871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:08:01+00:00 2026-05-25T18:08:01+00:00

I have a string List time1 with values (00:00 AM,00:30 AM, 01:00 AM, 01:30

  • 0

I have a string List time1 with values (00:00 AM,00:30 AM, 01:00 AM, 01:30 AM ……….. so on till 11:30 PM)

I also have a list appList of a custom object appointment__c.

This list hold only records of the set appointments

ie if a appointment is set for 8 AM – 8:30 AMand 10AM – 11:00AM then it would hold only these 2 records

I need to create a grid or table to show the appointments for the day from 00:00 AM to 11:30 PM.

I would need to read thru each row in time1 and check if there is a corresponding match to that time in appList, if its found then i need to show the details from appList else it should display as free against the time. I would also need to store it in a list so that i can use it in the VF page. How would i have to define this list?
Can i have the list store the time in one column and have list of appointment object in other column

Any better way of approaching this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:08:02+00:00Added an answer on May 25, 2026 at 6:08 pm

    In this case I’d use a class and have a list of objects for that class:

    class CTimeSlot
    {
        public Time           tStart         {get; set;}
        public Appointment__c sAppointment   {get; set;}
    
        public CTimeSlot(Time startTime)
        {
            tStart = startTime;
            Appointment__c = null;
        }
    }
    
    // ** snip ** 
    
    list<CTimeSlot> liTimeSlots = new list<CTimeSlot>();
    
    // ** snip ** loop through times, and for each add an entry to the list
    
        CTimeSlot newSlot = new CTimeSlot(loopTime);
        liTimeSlots.add(newSlot);
        mapTimeToSlot.put(loopTime + '', newSlot);
    }
    
    // ** snip ** when running through your query results of Appointment__c objects:
    for(Appointment__c sAppointment : [select Id, Time__c from Appointment__c where ...])
    {
        if(mapTimeToSlot.get(sAppointment.Time__c) != null)
        {
            mapTimeToSlot.get(sAppointment.Time__c).sAppointment = sAppointment;
        }
    }
    

    You can then fill this list with instances of CTimeSlot, and for times where you have an appointment set it to sAppointment on the instance — this could be made easier by having a map of the slots as well, mapping a time (as a string) to a CTimeSlot.

    In the page you could then just repeat over the list:

    <table>
    <apex:repeat var="slot" value="{!liTimeSlots}">
        <tr>
            <td><apex:outputText value="{!slot.tStart}"/></td>
            <td>
                <apex:outputText value="{!IF(ISNULL(slot.sAppointment), 'Free', slot.sAppointment.SomeField)}"/>
            </td>
        </tr>
    </apex:repeat>
    

    Hopefully this will give you some ideas and set you off on the right path!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a String List with items like this Root Root/Item1 Root/Item2 Root/Item3/SubItem1 Root/Item3/SubItem2
In Python, I have a string which is a comma separated list of values.
I have a dictionary of type Dictionary<string, IEnumerable<string>> and a list of string values.
I have a string list (TStrings) that has a couple thousand items in it.
I have List[(String,String)] and I need to sort them by the 2nd value and
I have a list string tag. I am trying to initialize a dictionary with
I have a string and a list of objects: gpl = %(id)s : %(atr)s
I have a string which is basically a list of words delimited by commas.
I have 2 collections of caracter string ex: List<string> one = new List<string>; one.Add(a);
I have the following code: // Form the continuities list string[] continuities = new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.