cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SectorOMEGA
Helper V
Helper V

Event counter control

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 

2 ACCEPTED SOLUTIONS

Accepted Solutions
WarrenBelz
Super User
Super User

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.

 

View solution in original post

Hi @SectorOMEGA ,

Create value for a Variable on each button OnSelect

Set(gblButton,1)

and so on for the rest. The value of gblButton (it will be numeric) will be the number of the button last pressed.

 

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.

 

View solution in original post

19 REPLIES 19
WarrenBelz
Super User
Super User

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
Super User
Super User

@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! 

@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 😄

 

Thank you so much! This was fast!

@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

Hi @SectorOMEGA ,

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

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 

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.

@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

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,503)