I am creating a vehicle reservation app and need to create a dropdown with vehicle name that coming from vehicle list, and filter the dropdown so that when a user reserved a vehicle in a date range this vehicle is removed from the dropdown, then be available after date time is due, for example if I reserve a vehicle today from 9 am to 10 am the vehicle should not be available in that time range, but then be available from 10 for new reservations. se code below
I am using tow list, vehicle list and reservations list, thanks in advance
Sort(
Distinct(
Filter(
'Vehicle List',
Not(
Title in Filter( ReservationList , (DateTimeValue(Text(StartTime)) >= (DateValue(Text( ddStartDate.SelectedDate))+Time(Value(ddHour.Selected.Value),0,0))),
((DateTimeValue(Text(EndDate))) <= (DateValue(Text( drdEndDate.SelectedDate))+Time(Value(ddEndHour.Selected.Value),0,0)))
).Vehicle
)),
Title),Result,
Ascending)