Form Builder Built-in Functions
Table of Contents:
- What are built-in functions?
- How do I count how many times an option was chosen in a form?
- How do I count the option occurrences for specific items in a form?
- Video instruction
What are built-in functions?
Built-in functions are default variables available to be used throughout your forms. They can capture the username of the person filling out the form, the first and last name of the user, their email address, OS type and more.
Our newest built-in function is used to count the number of times an option is selected.
How do I count how many times an option was chosen in a form?
To count how many times an option has appeared in a form, please follow the instructions below. In this example, we will count how many times users have picked "Fail".
STEP 1. Inside your form, create a few Select elements (Instead of Select, you can also use Pick List or Multi-Select).
STEP 2. Make sure all of these option-list-based elements are assigned the same Option List. In this example, all three Select elements have the option list "Gas Survey - Pass Fail", ID: 3554074.
Be sure to pay attention to the Option List ID.
There are 3 options inside this Option List.
Be sure to pay attention to the key_value of the option you need.
STEP 3. Create a new Read-Only element.
STEP 4. In the Dynamic Value field of the Read-Only element, place the following:
- iformbuilder.option.count: This remains the same on all forms.
- 3554047: You need to substitute this with your own Option List ID as shown in Step 2.
- fail: You need to substitute this with your own key_value as shown in Step 2(b).
PLEASE NOTE: If you are adding two fields with the option count function, you will need to use the Number() method, otherwise, it will concatenate:
Number(first_element) + Number(second_element)
STEP 5. Save your form.
STEP 6. Test it using your device or Webforms.
How do I count the option occurrences for specific items in a form?
What if you use the same option list Pass/Fail for 3 elements but only want to count how many times users have picked "Fail" for the first 2 elements?
Go back to Step 3, we will change the Dynamic Value to:
iformbuilder.option.count: Unchanging for any form
3550226: You need to substitute this with your own option list ID
fail: You need to substitute this with your own key value
question_1 , question_2: You need to substitute this with data column names of the elements that you want to count
VIDEO: How do I count how many times an option was chosen in a form?
Have a look at this quick walkthrough on how to count option occurrences in a form! You can also find the form package to download at the end of this article. The form name is: option_count_form.