Hi everyone,
I am building an app where users register time and I want to prevent the user from registering overlapping hours. For example, I register hours from 07:00 am to 15:00 pm, now the user is not allowed to register any hours within the period of time that already is posted. I have found one solution that works for the first registered hours by using the function under, but if I register two or more separate registrations then only the first one will trigger the rule.
If(
/*If starttime is earlier than existing time*/
Time(
Value(FromHour_12.SelectedText.Value),
Value(FromMinute_12.SelectedText.Value),
0
) <= LookUp(
CalendarEventsGallery1.AllItems,
!IsBlank(CalendarEventsGallery1.AllItems),
TimeValue(StartTime)
),/*Then*/
Time(
Value(FromHour_12.SelectedText.Value),
Value(FromMinute_12.SelectedText.Value),
0
) <= LookUp(
CalendarEventsGallery1.AllItems,
!IsBlank(CalendarEventsGallery1.AllItems),
TimeValue(StartTime)
) && Time(
Value(ToHour_12.SelectedText.Value),
Value(ToMinute_12.SelectedText.Value),
0
) <= LookUp(
CalendarEventsGallery1.AllItems,
!IsBlank(CalendarEventsGallery1.AllItems),
TimeValue(StartTime)
)/*If not*/
,
Time(
Value(FromHour_12.SelectedText.Value),
Value(FromMinute_12.SelectedText.Value),
0
) >= LookUp(
CalendarEventsGallery1.AllItems,
!IsBlank(CalendarEventsGallery1.AllItems),
TimeValue(EndTime)
),
Time(
Value(FromHour_12.SelectedText.Value),
Value(FromMinute_12.SelectedText.Value),
0
) >= LookUp(
CalendarEventsGallery1.AllItems,
!IsBlank(CalendarEventsGallery1.AllItems),
TimeValue(EndTime)
) && Time(
Value(ToHour_12.SelectedText.Value),
Value(ToMinute_12.SelectedText.Value),
0
) >= LookUp(
CalendarEventsGallery1.AllItems,
!IsBlank(CalendarEventsGallery1.AllItems),
TimeValue(EndTime)
)
),Edit,Disabled
As you can see from the pictures below, I have to registrations, and now I am not supposed to be able to register hours between 15:30 and 18:30, but "Ferdig" is not disabled.


Thank you,
Best,
Cathrine