One of the unique features of Cognito Forms is the ability to capture repeating data. Repeating data allows you to adjust the number of populated fields according to user needs, so you don’t have a fixed number of fields to only accommodate a small percentage of users.
For example, one user may need to include five people under a single event registration, but most users may only need one. By giving the first user the option to add new fields only as needed, you fill their needs while keeping it clutter-free for the second user.
To capture this data, just add a Repeating Section to your form and add the fields you want to capture in the repeating section. Cognito Forms can then take the data from these repeating sections and calculate the results for you, without any complicated coding. You can see this demonstrated in the following example.
This registration form above allows families to sign up for a conference, with options to select t-shirts, a round of golf, or prepaid arcade bucks… This particular user needs to register one adult and one child for the conference, but could add more guests if necessary. As new information is added to the form, the totals at the bottom of the page update automatically, making it very clear for the user (and you!) to review their registration for everything they need.
Here is a detailed breakdown of all of the calculations used to implement this form, highlighting the ease with which calculations can be created for repeating data using Cognito Forms. All calculations follow the basic logic of standard math. Calculating the total number of adults and children is as simple as using a “Count” function, specifying the result to be either “Adult” or “Child.”
Within the form, registrants are informed that they will receive a 25% discount on arcade bucks. This means they will only need to pay 75% of the value of the Arcade Bucks they want to purchase, so we need to multiply the Total Arcade Bucks by 0.75 to apply the discount. Similarly, when we are calculating a monetary total, such as a T-Shirt Fee or Golf Registration Fee, we multiply the total number of t-shirts or registrations by the cost for each person. For example, to calculate the total number of T-Shirts, we can add the total number of child attendees multiplied by the cost for a child’s t-shirt, and add it to the total number of adult attendees multiplied by cost of an adult t-shirt.
Although this example makes heavy use of the Count and Sum functions for repeating data, there are a number of additional functions supported as well.
As you can see, Cognito has powerful support for rich calculations, so the sky’s the limit. Check out Calculations Part One for more information on Cognito Calculations.