How to Count Repeats in a Form Using Calculations
Learn how to count repeats in a form using calculations in Smarter Drafter Pro.
In Smarter Drafter, you can use calculations to count how many times a repeatable section has been filled out in a form. This feature is helpful for tracking multiple entries, such as counting how many children a user has entered or how many items have been added. This guide will show you how to create a calculation to count the repeats in a form.
Instructions
1. Open the form that contains the repeatable section you want to count.
2. Create a New Field
-
Click on Add Field to create a new field. This field will hold the count of the repeated entries.
3. Choose the Field Type
- Select the Number field type to store the count of the repeats. This will ensure that the result is a numeric value.
4. Set Field Properties
- Fill in the necessary properties for the field, such as the field name (e.g., "Number of Children"). Set the field to Read-Only or Hidden, depending on whether you want the user to see the result
5. Select the Calculation Tab
- In the field properties, click on the Calculation tab to open the Calculation Builder tool.
6. Click Start Here
- Click the Start Here button to open the Calculation Builder tool. This tool will help you set up the repeat count calculation.
7. Choose the Data Type and Calculation Type
- In the Calculation Builder, select Fields - Repeatable as the data type. Then, choose RepeatCount as the calculation type. This will allow the calculation to count the number of times a repeatable section has been filled out.
8. Insert the Repeat Field
- Click the Reference Field drop-down and select the repeatable field you want to count. For example, if you are counting how many children a user has entered, select the field where the children’s details are recorded (e.g., "Child Name").
9. Insert the Expression
- The expression will be automatically generated to count the number of repeats. For example, if the reference field is "Child Name", the expression will look something like this:
- RepeatCount(Child Name)
10. Save the Field
- After inserting the expression, click Save to apply the calculation. The field will now display the number of repeats each time the form is filled out.
11. Test the Repeat Count
- Test the form by previewing it or filling it out. Add multiple entries to the repeatable section and check that the count field updates accordingly to reflect the number of repeats.
Common Issues & Solutions
- Issue: The repeat count is showing 0 or incorrect values
- Solution: Ensure that the correct repeatable field is selected in the calculation. The repeat count will only work if the field being counted is part of a repeatable section. Double-check that the field used for the repeat count is being filled out and that the calculation references the correct field.
- Issue: The calculation field is not updating dynamically
- Solution: Make sure the repeatable field is set up correctly and that the calculation is linked to the correct reference field. Also, verify that the form is being filled out and saved to trigger the update.