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 / Event counter control
Power Apps
Answered

Event counter control

(0) ShareShare
ReportReport
Posted on by 338

Im building a simple app to handle event registration forms in SP list. I have 4 events with two dates for each. Im looking for an option to add counter for each event occurrence as I need to limit attendees to 12 per session. Once the limit of 12 is reached I will disable the button for selecting the corresponding date. Is this achievable? Thank you in advance for your help 

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,956 Most Valuable Professional on at

    Hi @SectorOMEGA ,

    You would use CountRows() in conjunction with a filter

    If(
     CountRows(
     Filter(
     SPList,
     EventName = YourEvent &&
     DateField = YourDate
     )
     )>12,
     Notify("Event full")
    )

     

    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.

     

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @SectorOMEGA you can do a Count on the SP list like this,

    If(CountRows(yourSPList, Event=yourSlectedEvent && Date=yourSelectedDate)=12, DisplayMode.Disabled, DisplayMode.Edit)

    This code will go in the DisplayMode property of the button.

    Hope this helps! 

  • SectorOMEGA Profile Picture
    338 on at

    @WarrenBelz Always here to help! Thank you so much! Just need to figure out how to place date in button and push it to the SP List 😄

     

  • SectorOMEGA Profile Picture
    338 on at

    Thank you so much! This was fast!

  • SectorOMEGA Profile Picture
    338 on at

    @WarrenBelz Just trying to figure out the proper way to use the code that you have provided me so kindly. I have created a screen with 4 separate sections for the events. Each event has two available days which I have added as buttons made on pop up screen. I have created also a form that the date buttons navigate to in order to allow users to register themselves. How ever Im trying to figure out in this set up how to pass the selected date to the registration form in order to be able to count the people subscribed to it. Really appreciate the help and thank you in advance

  • WarrenBelz Profile Picture
    156,956 Most Valuable Professional on at

    Hi @SectorOMEGA ,

    What is the actual code you are using - the date would be where I have YourDate

  • SectorOMEGA Profile Picture
    338 on at

    So basically I have this:GDC.PNG

    And when a user is hitting the date button it navigates them to registration form based on the SP fields. Date 1 and Date 2 will be replaced with the respective dates and I want to pass the selected date to the registration form. If its possible I can Reuse one form screen only, if not I will hardcode the date in 8 different forms for registration in order to have it there and then try to setup the counter. Hopefully I have managed to explain it 

  • WarrenBelz Profile Picture
    156,956 Most Valuable Professional on at

    Hi @SectorOMEGA ,

    Getting down to basics here:-

    • You have a List with some events name and dates for these.
    • You have an interface where the user wants to register for an event on a day.
    • You have the two pieces of information necessary (the day and the event the user wants to register in)
    • To be able to the button, you need to test that number of current registrations for that event and day are less than 12, and if not stop the user registering.

    So going back to the code I originally posted, if you ran this on the DisplayMode of the button

    If(
     CountRows(
     Filter(
     SPList,
     EventName = YourEvent &&
     DateField = YourDate
     )
     )>=12,
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

    Have I misinterpreted anything in the above?
    The Navigation should not be relevant (although I must admit I cannot fully visualise your model from the description you have provided).

     

    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.

  • SectorOMEGA Profile Picture
    338 on at

    @WarrenBelz The thing that Im not getting is this: 

    EventName = YourEvent && DateField = YourDate 

    Where this property will go in the registration form as I want them to be hard coded in the registration form. I have tried passing the date to registration form with putting the date as Default date for the DateField, and for the counter function I have used:

    CountIf('SPList', EventDate = 06/20/2021)


    But still stays 0

    Im making simple label boxes that Im putting all the info for the event and Im splitting the screen in 4 equal parts for the event. Making me think I will need to make separate registration form for each event. 
    EventPreview.PNG

     

    Registration form.PNG

     

  • SectorOMEGA Profile Picture
    338 on at

    @WarrenBelz After digging and reading around I have finally made it working. For Date1 Button Text Im using the date when the event will happen. For the Date in all code below only this works for me:

    EventDate = DateValue("06/20/2021")

    After that I'm Passing the text of Date1 Button to my Registration Form Date Card using this code for Default Date:

    DateValue(Button4_4.Text)

    Finally Your code come in hand like this for the Display Mode:

    If(
     CountRows(
     Filter(
     'SPList',
     EventDate = DateValue("06/20/2021"))
     )>12,
     DisplayMode.Disabled,
     DisplayMode.Edit
    )

    Honestly I dont know how 'correct' is this approach but its working. Willing to hear your opinion 🙂

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard