zerion

Scroll
Follow

What are Subforms?

forms.jpg

h-all_About_Subforms.png

Contents

  1.  Overview of Subforms 
  2.  Using Subforms
  3.  Creating a Subform
  4.  Subform Record View
    1.  Customize Record View
  5.  Delete Subform Record
  6.  Record Status
  7.  Passing Data Using Subforms
  8. Hiding Subform

h-overview-of-subforms.png

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.

 subform_XLS_Feed

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.


h-Using-Subforms.png


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.

IPad Subform Element


2) Once the subform is opened, complete form and tap the 'Submit' or 'Done' button at the bottom of the form.

IPad-Subform.png

 

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.

IPad-Add-Subform-Record.png

 

4) When using a Separate Table View, it will show how many records have been taken on the Subform element on the Parent Form.

IPad-Subform-Record-Totals.png

 


h-creating-a-subform.png

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


 h--Subform-Record-View.png

The parent and sub-form record view are displayed differently with the 4.0 client update. This behavior is configurable using (iForm 4.2.0.11+) for the sub-form record display and is controlled on a per element basis. Not all subforms have to display records same way.

 
Subform - This menu allows you to choose what form you want to use as a sub-form. Since all forms on your account appear in this menu, any form can be a parent or a sub-form.

Link Mode - The link mode determines how many records can be captured for this particular subform element. Single will restrict the user to one record, while multiple will allow for X number of records to be captured.
 
Separate Table View - Choose this option if you want to see the subform records in a separate table view (rather than display the subform record summary below the element) ***Requires iForm 4.2.0.11+***

Subform_Smart_Paging_Options.png

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.
Image (Below) Example of Subform Record Views: 
1) "Subform Single Record on Page View" - Single Paging Selected and the Separate Table View box is UNCHECKED.
2) "Subform Multiple Record on Page View"- Multiple Paging Selected and the Separate Table View box is UNCHECKED.
3) "Subform Single Record Separate Table View"- Single Paging Selected and the Separate Table View box is CHECKED.
4) "Subform Multiple Record on Separate Table View"- Multiple Paging Selected and the Separate Table View box is CHECKED.
***When using Multiple Paging simply click on the Subform element or on the '+' sign for Separate Table View  to create a new subform record.

Subform_On_Page_View.png
Example of Subform view of Separate Table View CHECKED
Subform_Seperate_Table_View.png

Customize Record Table View

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.


 h-delete-subform-record.png

Delete Single Paging Sub-Form Record
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.

iphone_delete_Duplicate_Print.png


Passing Data Using Subforms

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.

 Click here for more information on how to use the built-in functions to build subform aggregation with numbers.  

Option 2: Subform Aggregation with Strings

There isn't a built in function to aggregate strings from an element on a multiple paging sub-form, however the simple steps in this article Subform Aggregation (Strings)  will assist you in achieving this goal. 

Option 3: Pass Data Between Levels using Single Link Subforms

There may be a situation when you want a user to enter data on the top level of their form(Parent Form) show on the lower level subforms (Child Forms). For step-by-step instruction, click on the help desk article Pass Data from Parent Form to Subform.
 

h-hiding-a-subform-once-completed.png

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. 

 

h-Common-Subform-Questions.png

 

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.

 


Related_Articles_v1.png

    Was this article helpful?
    3 out of 3 found this helpful
    Have more questions? Submit a request

Comments

  • Avatar
    bwilcox02

    Is it possible to determine which subform record I am on?  e.g. the user is editing record #5 out of 20

Powered by Zendesk