web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Button DisplayMode fai...
Power Apps
Answered

Button DisplayMode failing with multiple users

(0) ShareShare
ReportReport
Posted on by

Hi all,

 

I have a somewhat simple registration app. Users can scroll through a gallery of courses and register to attend.

 

On the DisplayMode property I have a formula (see below) that counts the course "Capacity" column (in SharePoint) and then determines if there are spaces left, the button remains in edit mode, but if the course is full, it disables.

 

This works well 98% of the time. But twice now, when we have added new courses, there is an influx of user registration, and the formula is failing, allowing for people to continue to register, even though the course is full.

 

I have noticed, once the count goes into -minus, the formula fails, and thinks the capacity is still okay to register.

 

I have used two formula's both work, but have they same glitch if the registrations go into minus.

 

DisplayMode property of the button:

Option 1:
If(
 ThisItem.'Total capacity' = Sum(
 ForAll(
 Filter(
 SP List,
 'Walk ID' = ThisItem.ID
 ),
 1
 ),
 Value
 ),
 DisplayMode.Disabled,
 DisplayMode.Edit
)

Option 2:
With(
 {
 _Walk: Filter(
 SP List,
 'Walk ID' = ThisItem.ID
 )
 },
 If(
 ThisItem.'Total capacity' = CountRows(_Walk),
 DisplayMode.Disabled,
 DisplayMode.Edit
 )
)

 

Is there a way to update either formula to failsafe against the count going into minus? I believe that should fix this glitch?

 

Thanks,

 

DW

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,240 Most Valuable Professional on at

    Hi @DGWolfe ,

    The second one is probably better

    With(
     {
     _Walk: 
     Filter(
     SP List,
     'Walk ID' = ThisItem.ID
     )
     },
     If(
     ThisItem.'Total capacity' = CountRows(_Walk),
     DisplayMode.Disabled,
     DisplayMode.Edit
     )
    )

    but how can the count be negative ?

  • DGWolfe Profile Picture
    on at

    @WarrenBelz, apologies, yes, you are correct. No negative. I have a label in the gallery that counts the remaining spaces left for each course. However, the few courses that have glitched, show negative spots, but it is just a count formula.

     

    I have taken a second look at the button's on select. It's a collection and patch (due to the fact I am pulling data from both a SharePoint list, and a few other inputs and patch all to a second SharePoint list.

     

    I just cant figure out why I have two courses now, where the button has failed to disable because the capacity is full?

  • WarrenBelz Profile Picture
    155,240 Most Valuable Professional on at

    @DGWolfe ,

    Maybe some old fashined debugging on two labels in the gallery

    With(
     {
     _Walk: 
     Filter(
     SP List,
     'Walk ID' = ThisItem.ID
     )
     },
     CountRows(_Walk)
    )

    and 

    ThisItem.'Total capacity'
  • DGWolfe Profile Picture
    on at

    @WarrenBelz thanks.

     

    I have manually corrected the entries from the back end. But I added the above, and they are returning the correct counts. It's just stumped me why two have failed but the rest have all worked as expected.

     

    DW

  • WarrenBelz Profile Picture
    155,240 Most Valuable Professional on at

    Hi @DGWolfe ,

    It would puzzle me as well if the two labels in the gallery show equal values and the button was still enabled.

  • Verified answer
    DGWolfe Profile Picture
    on at

    @WarrenBelz I think I fixed it.

     

    https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-table-counts says that:

     

    • If the CountRows(<Data Source>) function is used without filtering, the count might not be 100% accurate, because the cached count updates periodically. If you need precise count and expect the result to be under the aggregate limit, you can bypass the cached count via CountIf(<Data Source>, True).

    As such, I've updated the formula to: 

     

    With(
     {
     _Walk: Filter(
     'SP List',
     'Walk ID' = ThisItem.ID
     )
     },
     If(
     ThisItem.'Total capacity' = CountIf(_Walk,true),
     DisplayMode.Disabled,
     DisplayMode.Edit
     )
    )

     

    So now I will monitor and see!

     

    Thanks for the help to date!

     

    DW

  • WarrenBelz Profile Picture
    155,240 Most Valuable Professional on at

    @DGWolfe ,

    I have used CountRows for many years and have never seen it produce an inaccurate result, but I guess there is a first time for everything.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 914

#2
11manish Profile Picture

11manish 627

#3
Valantis Profile Picture

Valantis 598

Last 30 days Overall leaderboard