I am implementing booking tool for process. There is inventory you can use – if you want to book process for a day AM and PM slot of this day is being used up. Then when calendar is being displayed, it brings all existing bookings showing for example that this room is not available in specific period of time.
Difficulty I am having is, that returned entries that are being displayed NOT in order so ‘AM’ slot after ‘PM’ slot. it all seem quite random it might be confusing for end user.
SELECT * FROM
(
select
query to select room 1 where slot is AM
UNION ALL
query to select room 1 where slot is PM
UNION ALL
query to select room 2 ( this room can be booked only for whole day )
)
ORDER BY slot ASC
this is structure of query I used. It returns entries correctly but not in order. I presume it is due to nested select statements.
What is the best approach to solve this problem?
After losing hope to over come this problem I accidentally stumbled across solution for the problem. Basically Apex calendar rely on date column but if there more than one record assigned to one day then it display them in random order. Some people suggested adding another column to add some ordering into it, however this would produce another layer of complexity which is not necessary. Solution:
by adding rownum parameter to date column Apex can pick up difference between records and suddenly everything works as it should be with normal order by.