- Overview of Subforms
- Using Subforms
- Creating a Subform
- Subform Record View
- Delete Subform Record
- Record Status
- Passing Data Using Subforms
- Hiding Subform
The Subform can be used to condense your form and break up larger form sections into a smaller form called a Subform. Subforms should take form elements that would originally be on the Parent Form and add them to a separate form that will be linked to the Parent Form. Subforms (just other forms that you link to a parent form) separate the data collected into different tables. Here is an example of what is looks like in XLS Feed. The Parent form is the first form and the subforms are the pages after.
When building subforms we suggest using a naming convention for the Table name to show the relationship. This also keeps the forms together in FormBuilder.
Table Naming Convention Example:
- Parent Form: usa_lab_Inspection_parent
- Child Form(Subform): usa_lab_Inspection_chemicals_child
*NOTE: The parent name is carried over into the child/subform + child/subform name.
The image below shows the process of using a Subform Element. In this example, a Multiple Record is selected and Separate Table View has been checked off.
1) Mathematical Functions is the Subform Element on the Parent Form. Tap to open Child Form/Subform.
2) Once the subform is opened, complete form and tap the 'Submit' or 'Done' button at the bottom of the form.
3) To create another record in this view, tap the '+' button in the top right corner. *Note: When not using a Separate Table View, tap the element in the form to create another record. **If Single is selected for Link Mode user will not have ability to create another record. Can always edit records before they have been synced to the cloud.
4) When using a Separate Table View, it will show how many records have been taken on the Subform element on the Parent Form.
To create a Subform and attach it to a parent form follow these easy steps :)
Lets say we have a form called home_inspection that will be used as the Parent Form. This form will utilize a Subform to organize the different houses inspected daily.
1. First we will start out by selecting Create New Form from the FormBuilder Home. I will give the form a Label of Houses Inspected and the Database Table Name of home_inspection_subform.
2. Now its time to create the content inside the subform by adding elements inside the form.
3. After you have finished creating the form the next step is to link the Subform to the Parent Form. At this point go back into FormBuilder by Clicking Forms > FormBuilder.
Note: After Creating a subform do not go back to the FormBuilder Home by clicking Load at the bottom right, instead go through the Top Navigation by clicking Forms > FormBuilder or your newly created form will not appear on the Smart Paging Tab.
4. Open up your Parent form ie home_inspection and add a new Subform Element to the form. The Subform element requires that you select a Subform for the element to be pointing to.
5. Make sure the Subform element is selected and click the Smart Paging Tab under Element Properties. Select the form that you just created ie home_inspection_subform, then select a Link Mode and check the Separate Table View Checkbox to view subform records in a different fashion. Refer to the Subform Record View Below for more information on Link Modes and Separate Table View. When you are finished Save your form.
6. Next you will want go into the Forms > Form Assignment tab and select the form that is being used for the subform ie home_inspection_subform and uncheck the Collect checkbox for all users so that the Form will not appear on the device in the form menu but will still appear as a subform under the home_inspectionform.
The parent and sub-form record view are displayed differently with the 4.0 client update. This behavior is configurable using (iForm 126.96.36.199+) for the sub-form record display and is controlled on a per element basis. Not all subforms have to display records same way.
After completion of a Subform record, the record is displayed differently at the parent level depending on the 'Link Mode' and 'Separate Table View' box selections.
For each record, a table is created to show data collected on a form. To customize what fields are displayed you can use Reference ID 2 in the Edit Form Properties page and the index value of each element that you want in the table.(To find the element index of an element, select the element in FormBuilder and click on the Info Tab.) Go to the Reference ID Overview Article to see how this can be done.
To delete a single paging sub-form record you must touch and hold any part of the record and when the Delete option appears select it to delete the single paging sub-form.
Subforms have the ability to take data from the subform on the 'child' level and access it on the 'parent' level and vice versa.
Option 1: Subform Aggregation with Numbers
Using iFormBuilder Built-in Functions iformbuilder.math.sum and iformbuilder.math.avg Subform Aggregation lets you keep a running total, or average of a sub-form element and then display this total value on the parent form. Subforms can be set to allow for multiple paging, which creates an array of records. A built in function will sum, or average the same element over the entire array of records. *Subform Aggregation may be useful for a purchase order scenario where customers may be purchasing a number of items and you want to keep a running total of all items.
- iformbuilder.math.sum - this will add the values you are bringing over to the parent from the array and display the sum of those values
- iformbuilder.math.avg - this will average the values you are bringing over to the parent from the array and display the average of those values.
Option 2: Subform Aggregation with Strings
Option 3: Pass Data Between Levels using Single Link Subforms
Upon Completion of a subform you may want to hide the subform element so that it cannot be accessed after it is filled out.
To do this check out this example
Lets assume the following:
Form Name: my_form
Sub-Form Element: my_sub
Number Element: my_sub_number
1. Create a number element and add it right below the subform element and give it the Dynamic Value of: my_form.my_sub.length (This is giving a number to the length of the data in the subform (to start will be 0). The length of the subform changes when elements of the subform have been filled out and the user selects done or save.)
2. Set the Conditional Value of the number element to false. (This will make the number element not show up on your form.)
3. Then go into the subform element on the parent form and add: my_sub_number == 0 to the Conditional Value.
Q: Existing subform data with matching parent record ID doesn't appear on Parent record with hyperlink and subform count. Why?
A: The subforms are still linked (even though you don't see the link in the List View). The likely answer is that you assigned this record to someone and they didn't touch those subform records that seem to be unlinked.
When the parent record is uploaded again to the server the "count" for those subform elements is 0 which is the reason you don't see the hyperlink on the List View. Just to confirm all data in those subforms still tie back to the parent record and nothing has been lost. The List View page is simply not showing the link.
- Form Assignment
- Smart Control Overview
- How do I hide a subform after it has been completed?
- How do I Perform Mathematical Calculations?
- Record Status Icons
- Pass Data from Parent Form to Subform.
- iFormBuilder Built-in Functions Overview (Subform Aggregation with numbers)
- Concatenate Strings Over Many Records (Subform Aggregation)
- Reference ID Overview Article
- Glossary of Terms
- Release Notes