Skip to main content
Community site session details

Community site session details

Session Id : H+WpSFtRWbnK3w73PT2c+p
Power Apps - Building Power Apps
Answered

Unable to Capture ComboBox is Empty after it is Cleared by Datasource Refresh

Like (0) ShareShare
ReportReport
Posted on 26 Jan 2024 05:35:46 by 473

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.

  • Verified answer
    v-yueyun-msft Profile Picture
    on 26 Jan 2024 at 07:16:16
    Re: Unable to Capture ComboBox is Empty after it is Cleared by Datasource Refresh

    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

  • ruihaolrh Profile Picture
    473 on 26 Jan 2024 at 07:08:14
    Re: Unable to Capture ComboBox is Empty after it is Cleared by Datasource Refresh

    Hi @v-yueyun-msft , thanks for the formula. I attempted too, but encountered an error too

    Invalid schema, expected a one-column table.

    gymcode_0-1706252858041.png

     

    Let me try a code for delay to see if it works.

     

  • v-yueyun-msft Profile Picture
    on 26 Jan 2024 at 07:02:32
    Re: Unable to Capture ComboBox is Empty after it is Cleared by Datasource Refresh

    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

  • ruihaolrh Profile Picture
    473 on 26 Jan 2024 at 06:57:38
    Re: Unable to Capture ComboBox is Empty after it is Cleared by Datasource Refresh

    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.

     

    gymcode_0-1706252173877.png


    Edit: My 'Seat-Ddl' does display the name field of the entity.

    gymcode_0-1706252567844.png

     

  • ruihaolrh Profile Picture
    473 on 26 Jan 2024 at 06:38:34
    Re: Unable to Capture ComboBox is Empty after it is Cleared by Datasource Refresh

    Hi @v-yueyun-msft , below is the sequence of events, which I hope it will help


    1) Session A selects a Desk

    gymcode_0-1706250700674.png


    2) Session B selects and books the same Desk. A new Reservation Detail record is created, associated to this Desk.

    gymcode_1-1706250801038.png


    3) Session A screen clicks 'Book' button.

    gymcode_4-1706250949968.png


    4) Session A Seat value gets cleared without Notify message.

    gymcode_3-1706250874480.png

     

    5) Session A clicks 'Book' button again, and Notify message is shown.

    gymcode_5-1706251031903.png

    ________________________________________________________________________________

    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
     )
    );
  • v-yueyun-msft Profile Picture
    on 26 Jan 2024 at 06:38:08
    Re: Unable to Capture ComboBox is Empty after it is Cleared by Datasource Refresh

    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
     )
    );

     

    vyueyunmsft_0-1706251081868.png

     

     

    Best Regards,

    Yueyun Zhang

  • ruihaolrh Profile Picture
    473 on 26 Jan 2024 at 06:18:52
    Re: Unable to Capture ComboBox is Empty after it is Cleared by Datasource Refresh

    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.

  • ANB Profile Picture
    7,162 Super User 2025 Season 2 on 26 Jan 2024 at 06:14:27
    Re: Unable to Capture ComboBox is Empty after it is Cleared by Datasource Refresh

    @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

  • v-yueyun-msft Profile Picture
    on 26 Jan 2024 at 06:13:09
    Re: Unable to Capture ComboBox is Empty after it is Cleared by Datasource Refresh

    Hi , @gymcode 

    As the code is only judge the combo box selected is blank , the message will show like this:

    vyueyunmsft_0-1706249532868.png

     

    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

     

     

     

  • ANB Profile Picture
    7,162 Super User 2025 Season 2 on 26 Jan 2024 at 06:10:28
    Re: Unable to Capture ComboBox is Empty after it is Cleared by Datasource Refresh

    @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


     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading started