Re: If Statement to Prevent Double Bookings in App
Hi @BS10 ,
Because of this the structure of the formula needs to be changed a bit, but I think the below should do the trick:
With(
{_SelectedStartTime: DateTimeValue($"{DateValue1.SelectedDate} {HourValue1.Selected.Value}:{MinuteValue1.Selected.Value}"),
_SelectedEndTime: DateTimeValue($"{DateValue2.SelectedDate} {HourValue2.Selected.Value}:{MinuteValue2.Selected.Value}")},
If(
_SelectedStartTime >= _SelectedEndTime,
Notify(
"The selected end date/time is before or equal to the selected start date/time",
NotificationType.Error
),
IsBlank(
LookUp(
BookLaptopTrolley,
'Laptop Trolley Name'.Value = DataCardValue7.Selected.Value &&
((_SelectedStartTime >= 'Start Time' && _SelectedStartTime < 'End Time') ||
(_SelectedEndTime > 'Start Time' && _SelectedEndTime <= 'End Time') ||
(_SelectedStartTime <= 'Start Time' && _SelectedEndTime >= 'End Time'))
)
),
SubmitForm(EditForm1),
Notify(
"This equipment is already taken out at that time",
NotificationType.Error
)
)
For further new questions, please open a new topic so it is easier for other members of the community to find the answers their similar questions.