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?
In this case I’d use a class and have a list of objects for that class:
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:
Hopefully this will give you some ideas and set you off on the right path!