Hi everyone,
I need some help to make condition for duplicate booking meeting room, the attribute entity is Date, Start Time and End Time.
The objective is to restrict staff members that booking the meeting room on the same date, start time and end time as other staff member that has already booked. I'm unsure how to enforce the condition for overlapping bookings by other staff within the same time frame.
This is picture where I tried to make the condition for duplicate. So, at Data tab, under BookingDetail entity there are MeetingDetail,Date,StartTime and EndTime.
@SyakirahTo achieve this you need to add a filter condition in the existing booking entity aggregate - DB_Date = InputParam_BookingDate and((DB_StartTime <= InputParam_ endTime and DB_ EndTime >= InputParam_ startTime) or (DB_ StartTime < InputParam_ endTime and DB_ EndTime > InputParam_ startTime))after that -check if the above aggregate Isempty?if Yes - allow to save if No - Do not allow for bookingThis should work in your scenarioCheers,Shriyash Dixit
Thank you so much, it worked. Thank you Shriyash
Glad to help! Cheers
Hi Syakirah,
I think you can do this by few methods, let me specify one method.
You can use one aggregate to fetch the all the booking first then you can use a calculated attribute in that aggregate to check whether the start date time entered by using the expression such as "BookingDetail.Startdatetime <= InputBookingDetail.StartDateTime and InputBookingDetail.StartDateTime <= BookingDetail.EndDateTime", this will give you true as output if the condition matches and you can repeat the same for the end date time.
After that you can use List Any server action to check any of the record in the aggregate is true in either of the 2 calculated attributes.
This can help you to avoid the duplicate entries, I think so.
Hi @Syakirah ,In Booking_Detail Aggregate filter by Room no , Booking date get from the inputs and also filter bystart time is greater than End time . After check the condition if Aggregate is empty you allow to create the record.Thanks
Can you please share your OML to solve this.
Hi Venkatesaiya, mine has already worked, thank you for the idea.