I have a Desk ComboBox 'Desk_Ddl' containing a list of 'Desks' available for booking.
On a 'Book' button click, it refreshes the 'Desk' datasource, and clears 'Desk_Ddl' if the Desk has been booked by someone else in the meantime.
Below is my 'BookButton.OnSelect' formula for the above logic
Refresh('Reservation Details'); <<--Refresh Desk Datasource
If(
IsEmpty(Seat_Ddl.SelectedItems) || IsBlank(Seat_Ddl.SelectedItems),
Notify(
"Your seat has just been booked by someone else. Please select another seat.",
NotificationType.Error,
3000
)
);
My 'Seat_Ddl' do get cleared on 'Desk' datasource refresh, but the notification does not appear.
I tried the reverse, where !IsEmpty or !IsBlank, and the notification do appear.
May I know how I can capture 'Seat_Ddl' being empty?
Thank you.
Hi , @gymcode
Can you try to use this:
Refresh('Reservation Details');
If(
IsEmpty(Self_Section_Seat_Ddl.SelectedItems) || IsBlank(Self_Section_Seat_Ddl.Selected) || IsBlankOrError(Self_Section_Seat_Ddl.SelectedItems)|| !(Seat_Ddl.Selected.Value in
Filter(
Filter(
'Bookable Desk',
Area.'Area (hsl_areaid)' = Area_Ddl.Selected.'Area (hsl_areaid)' && Facility.Facility = Building_Ddl.Selected.Facility && !IsBlank(XCoor) && !IsBlank(YCoor) && NumberOfDays > 0
) As AllDesks,
!(
AllDesks.Name in ForAll(
Filter(
'Reservation Details',
'Reservation Details (Views)'.'Active Upcoming Reservation Details',
Date >= FromDate_Dp.Value,
Date <= ToDate_Dp.Value && ('Status Reason' = 'Status Reason (Reservation Details)'.Blocked || 'Status Reason' = 'Status Reason (Reservation Details)'.Booked)
),
'Reserved Desk'.Name
).Value
)
).Name
),
Notify(
"Your seat has just been booked by someone else. Please select another seat.",
NotificationType.Error,
3000
)
);
You can try to add the '.fieldName' after your filter() function.
Best Regards,
Yueyun Zhang
Hi @v-yueyun-msft , thanks for the formula. I attempted too, but encountered an error too
Invalid schema, expected a one-column table.
Let me try a code for delay to see if it works.
Hi , @gymcode
In my understand , this may happen when the refresh() is refreshing but the below formulas has been executed.
Can you try to add a delay after the refresh function in your side to test? Or add the judge like this:
Refresh('Reservation Details');
If(
IsEmpty(Self_Section_Seat_Ddl.SelectedItems) || IsBlank(Self_Section_Seat_Ddl.Selected) || IsBlankOrError(Self_Section_Seat_Ddl.SelectedItems)|| !(Seat_Ddl.Selected.Value in Filter(
Filter(
'Bookable Desk',
Area.'Area (hsl_areaid)' = Area_Ddl.Selected.'Area (hsl_areaid)' && Facility.Facility = Building_Ddl.Selected.Facility && !IsBlank(XCoor) && !IsBlank(YCoor) && NumberOfDays > 0
) As AllDesks,
!(
AllDesks.Name in ForAll(
Filter(
'Reservation Details',
'Reservation Details (Views)'.'Active Upcoming Reservation Details',
Date >= FromDate_Dp.Value,
Date <= ToDate_Dp.Value && ('Status Reason' = 'Status Reason (Reservation Details)'.Blocked || 'Status Reason' = 'Status Reason (Reservation Details)'.Booked)
),
'Reserved Desk'.Name
).Value
)
) ),
Notify(
"Your seat has just been booked by someone else. Please select another seat.",
NotificationType.Error,
3000
)
);
Best Regards,
Yueyun Zhang
Hi @v-yueyun-msft , thank you for the assistance. I tried the formula, but encounter an issue when comparing the 'Seat-Ddl.Selected.Name' against my [Seat_Ddl-items functions]
PowerApps can't convert this Text to Table.
Edit: My 'Seat-Ddl' does display the name field of the entity.
Hi @v-yueyun-msft , below is the sequence of events, which I hope it will help
1) Session A selects a Desk
2) Session B selects and books the same Desk. A new Reservation Detail record is created, associated to this Desk.
3) Session A screen clicks 'Book' button.
4) Session A Seat value gets cleared without Notify message.
5) Session A clicks 'Book' button again, and Notify message is shown.
________________________________________________________________________________
Desk_ComboBox (Seat).Items formula:
Filter(
Filter(
'Bookable Desk',
Area.'Area (hsl_areaid)' = Area_Ddl.Selected.'Area (hsl_areaid)' && Facility.Facility = Building_Ddl.Selected.Facility && !IsBlank(XCoor) && !IsBlank(YCoor) && NumberOfDays > 0
) As AllDesks,
!(
AllDesks.Name in ForAll(
Filter(
'Reservation Details',
'Reservation Details (Views)'.'Active Upcoming Reservation Details',
Date >= FromDate_Dp.Value,
Date <= ToDate_Dp.Value && ('Status Reason' = 'Status Reason (Reservation Details)'.Blocked || 'Status Reason' = 'Status Reason (Reservation Details)'.Booked)
),
'Reserved Desk'.Name
).Value
)
)
'BookButton.OnSelect' formula:
Refresh('Reservation Details');
If(
IsEmpty(Self_Section_Seat_Ddl.SelectedItems) || IsBlank(Self_Section_Seat_Ddl.Selected) || IsBlankOrError(Self_Section_Seat_Ddl.SelectedItems),
Notify(
"Your seat has just been booked by someone else. Please select another seat.",
NotificationType.Error,
3000
)
);
Hi , @gymcode
As i test it in my side , when i refresh my datasource , the combo box items will refresh , but the selected item will not clear in my app..
You may need to add the judge in your notify to re-get the filter items , like this:
Refresh(DeepLink) ;
If(
IsEmpty(Seat_Ddl.SelectedItems) || Seat_Ddl.Selected.Value=Blank()|| !(Seat_Ddl.Selected.Value in [Your Seat_Ddl-items functions] ) ,
Notify(
"Your seat has just been booked by someone else. Please select another seat.",
NotificationType.Error,
3000
)
);
Best Regards,
Yueyun Zhang
Hi @v-yueyun-msft , as my combobox gets all 'Desk' entities that does not have an associated 'Reservation Detail' record that is still a valid reservation.
Therefore, if another user books the selected Desk in the meantime, there will be a new 'Reservation Detail' record created, which the Desk is associated to, thus removing that particular desk from the Combobox.
I use another browser session to book a desk. Once it's booked, I click on my 'Book' button in my session, which then <Refresh('Reservation Details');> datasource.
@gymcode Modern Combo box will not have the Reset property and I believe you are using modern combo box. Gave suggestion in previous post. Use that. Reset(Self_Section_Seat_Ddl)
Thanks,
ANB
Hi , @gymcode
As the code is only judge the combo box selected is blank , the message will show like this:
And in your side , how do you check if the seat has been booked by someone else in the meantime and then reset this combobox?
Best Regards,
Yueyun Zhang
@gymcode If it is modern combo box control then
Refresh('Reservation Details'); <<--Refresh Desk Datasource
Reset(Self_Section_Seat_Ddl);
If(
IsEmpty(Self_Section_Seat_Ddl.SelectedItems) || IsBlank(Self_Section_Seat_Ddl.Selected),
Notify(
"Your seat has just been booked by someone else. Please select another seat.",
NotificationType.Error,
3000
)
);
-----------------------------------------------------------------------------------------------------------------------------
I hope this helps.
Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍
Thanks,
ANB
WarrenBelz
637
Most Valuable Professional
stampcoin
570
Super User 2025 Season 2
Power Apps 1919
473