Limit sign ups to 20 per month

Is there a way in which I can limit the number of sign ups based on the subscription plan?

Im doing a sleep diary. The doctor signs up and pays the subscription. They are allowed say 20 patient sign ups per month. The patient signs up and during sign up selects the doctor they are seeing.

How would I prohibit more than 20 sign ups for a doctor per month?

Two approaches:

  • In the expression that populates the list of doctors that a patient can select, add criteria to exclude doctors who have already used their quota.
  • When a patient selects the doctor, then use a search to evaluate whether the selected doctor has already used their quota.

So if I did a sum with constraints to count how many times a doctor has been selected then that would work, but how would I do the constraint that said within a calendar month?

add the date and the doctor constraint.

I understand that. but it would need to be dynamic. So it would need to change every month, or on some set cycle. What I am asking is there a way to do a constraint that repeats on a cycle of time. Not from date to date. Or I would be changing the constraint each month

Use Current Date with the change date to operator to return the first day of the current month.

You are a legend. Thank you