iFormBuilder Subforms
Table of Contents
- What is a Multi-Paging Subform?
- How do I count the number of Multi-Paging Subform records?
- Download the Form Package
What is a Multi-Paging Subform?
A Multi-Paging Subform allows the user to capture multiple records under the same Subform element. This can be great for data such as Images, Text Areas and any elements that capture large amounts of the data.
Use Multi-Paging subforms so that when capturing large amounts of data, the records go up one at a time instead of trying to go all at once which can cause issues with data upload.
How do I count the number of Multi-Paging Subform records?
PLEASE NOTE: The following instructions make the assumption that you've already added a Multi-Paging Subform element to your form. If you need instructions on how to do so, please click HERE.
To add a field that counts the number of Multi-Paging Subform records, please follow the instructions below.
STEP 1. Under your Subform element, add a Read-Only element.
STEP 2. In the Dynamic Value of the Read-Only element, you'll use the following JavaScript structure:
parent_table_name.subform_element_data_column_name.length
In this specific example, the Dynamic Value will be:
count_number_of_subform_records.this_is_my_subform.length
- Parent Table Name: count_number_of_subform_records
- Subform Element Data Column Name: this_is_my_subform
STEP 3. Save your form.
STEP 4. Test the functionality on your device.
PLEASE NOTE:
If your subform is nested inside another subform which is Single link use this:
my_parent_form.first_subform_element[0].nested_subform_element.length
If your subform is nested inside another subform which is Multiple link use this:
my_parent_form.first_subform_element[my_parent_form.first_subform_element.index].nested_subform_element.length
Download the below form package to use as an example.
Comments
6 comments
This is great. However - when there are no subforms this doesn't appear to evaluate and leaves the field blank. I need something that returns 0 when there are 0 subforms. Thanks
I've found that if (typeof my_parent_form.subform_element_in_parent !== 'undefined') is a way to get around this....
Hi,
is there any change in "If your subform is nested inside another subform which is Multiple link use this:"
my_parent_form.first_subform_element[my_parent_form.first_subform_element.index].nested_subform_element.length
previously was working it's just stopped working yesterday
best
Hi Izzuddin, please check the names of all your forms and elements to make sure they are the same as your code as that is the most likely reason for the sudden change in behavior.
Thanks, Tony I just do renaming of all linked elements and its worked well
I'm working at a subform level with a subform that I want to count but cant seem to get this to work.
Please sign in to leave a comment.