Counter demo

This form demonstrates how to use database counter.

 

THIS FORM IS FOR DEMONSTRATION PURPOSES ONLY - BY SUBMITTING THIS FORM YOU ARE NOT SIGNING UP FOR ANY EVENT.

This is implemented mainly via the workflow configuration. To see the workflow of this form, you can log in with the demo account, export the form and re-import it into your local FORMCYCLE.

This form shows how a database counter can be used in the workflow:

  • Each counter has a name and a numeric value. The value can be incremented and decremented. It is also possible to check the value of a counter against a condition.
  • For each bookable lesson (Monday to Friday), there is a separate counter that keeps track of the number of reservations for that lesson.
  • The current counter values (free spaces) are written into the labels using placeholders when the form is opened.
  • When the form is submitted, the value of the counter for the selected date is incremented by one.
  • When multiple people open the form simultaneously and submit it some time later, the allowed maximum number of reservation might be exceed. To prevent this, the value of the counter is checked agaub against the allowed maximum on the server. This server-side validation also prevents intentional manipulation attempts.
  • Once submitted, form records are put in the state Eingegangen. When a form in that state is opened, a button for cancelling the reservation is shown. If that button is clicked, the counter is decremented by one and the process is deleted.
  • The counter is reset each sunday at 4:00 AM. When a user cancels a reservation from a previous week, this would decrement the counter and result in a wrong count. To prevent this, there is another counter fclesson_weekly_cycle that is incremented when the other counters are reset (each sunday at 4:00 AM). When the user signs up for a lesson, the current value of the weekly cycle counter is stored in the form record. Now, when the user attempts to cancel a reservation, we can check whether the value of the counter fclesson_weekly_cycle is different from the value stored in the form record. If it is, the counter is not decremented and an appropriate message is shown to the user.
Your data
Preferred date
powered by XIMA® formcycle