Using the Count Function
Using the Count Function
I'm creating a form so attendees to a education conference can register to attend training courses that are on during the 2 day event. During that day, breakout sessions are scheduled, and at each breakout session, multiple training courses are running at the same time in different locations around the school. My original problem was creating a form to record the different courses chosen, but also create a maximum number of attendees per training course.
I've managed to create a dummy form that can record the different breakout times and the related courses. I've copied the example from the help page on count functions, but I've combined it with another example i found elsewhere.
In that example, another form was used for a lookup list and the formula is placed in the "validate" section of the form design. See below.
=============================
- if ( (count(Event_Registration[Lookup_1 == input.Lookup_1]) >= 2) )
- {
- alert ("Sorry, the course you have chosen for breakout session 1 has reached its maximum attendance limit. Please try another session.");
- cancel submit ;
- }
- if ( (count(Event_Registration[Lookup_2 == input.Lookup_2]) >= 2) )
- {
- alert ("Sorry, the course you have chosen for breakout session 2 has reached its maximum attendance limit. Please try another session.");
- cancel submit ;
- }
- if ( (count(Event_Registration[Lookup_3 == input.Lookup_3]) >= 2) )
- {
- alert ("Sorry, the course you have chosen for breakout session 3 has reached its maximum attendance limit. Please try another session.");
- cancel submit ;
- }
- if ( (count(Event_Registration[Lookup_4 == input.Lookup_4]) >= 2) )
- {
- alert ("Sorry, the course you have chosen for breakout session 4 has reached its maximum attendance limit. Please try another session.");
- cancel submit ;
- }
==========================
By a lucky accident, I found that the form records whatever amount I used as the maximum for the number that can attend each of these training courses. (I set the numbers to a low 2, so I could test the form)
I'm not very good with using formula, but I've managed to create something that can do the job. My only problem now is that some of the courses inside the breakouts have a different maximum limits of attendees.
How can I change this formula to do this?