Overview of the Built-in iFormBuilder Functions

iform built-in functions

iFormBuilder has the following built-in functions:

  • iformbuilder.username- Displays the username of the user who created the record on the device. 
  • iformbuilder.firstName- Displays the first name of the person signed into the device. 
  • iformbuilder.lastName- Displays the last name of the person signed into the device. 
  • iformbuilder.email- Displays the email address of the person signed into the device. 
  • iformbuilder.math.sum- Adds the values from the records taken in a Subform and displays the sum of those values in the Parent Form.
  • iformbuilder.math.avg- Finds the average from the records taken in a Subform and displays the average on the Parent Form. 
  • getNextSequence()- Allows the user to keep track how many records this user has provided.

display username

Place iformbuilder.username in the Dynamic Value of a Text or Read-Only Widget.  It will display the username inside an element of the user that is currently logged in on the device.  




Please watch the high definition video below, which walks you through a real life example of subform aggregation. Once you understand how this works you can modify the example to suit your specific needs.

Subform Aggregation Demo


Subform Aggregation (Numbers)

Subform Aggregation Addition lets you keep a running total of a sub-form element and then displays this total value on the parent form. This 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. Using subform aggregation would be the ideal way to set this form up.  When using subform aggregation, most of the functionality will be written in the Parent Form.  But, you will need to refer to the specific element from the Subform. 

PLEASE NOTE: Checking the "read-only" box on the input properties of the number or text field will cause the calculation to fail.  

Steps in the Subform

For this example, I have created a new form to be my subform in which the user will input numbers.  

1. In this new subform, I created an element with the DCN: element_on_subform.  (Later in the parent form, you will have to refer to this element's DCN.)

2. In "Smart Control"  for this element, I have placed the following code in the Dynamic Value: element_on_subform=""  (This reiterates the DCN assigned to this element for when the element is "called to" on the Parent Form)


Steps In the Parent Form

1. Create an element with the input property of a Subform.  For this example, the DCN is: subform_to_aggregate_totals 

2. Under "Smart Paging" select the subform that you will be adding the results from.

a) In "Smart Paging" choose "Multiple" for the link mode. 


3. Create another element with an input property of "Text" or "Read-Only."  For this example the elements DCN is: subform_aggregation_addition


4.  In the element subform_aggregation_addition, under the "Smart Control" section place the following syntax in the Dynamic Value:  iformbuilder.math.sum(table_name.subform_element_dcn, 'element_on_subform')

replace the following with your DCN's:

  • table_name: Parent Form Table name
  • subform_element_dcn: The Subform element's DCN on the Parent Form. 
  • element_on_subform: The element's DCN on the Subform. 

 Example: iformbuilder.math.sum(ifb_builtin_function_demo.subform_to_aggregate_totals, 'element_on_subform')




Subform Aggregation Average follows the same steps as the above Subform Aggregation Addition except for Step 4. Instead of using iformbuilder.math.sum, you will use the syntax: iformbuilder.math.avg(table_name.subform_element_dcn, 'element_on_subform')

 Example: iformbuilder.math.avg(ifb_builtin_function_demo.subform_to_aggregate_totals, 'element_on_subform')





The purpose of the getNextSequence() function allows the user to keep track how many records they have completed.  The count starts at 1, and for every record started, the count will increment +1.  It is very similar the "Unique Id" input property.  The difference is the "Unique Id" input will increment when it actually hits the server.  getNextSequence() will increment locally on the device.  Also, each user can have its own count on the same device.  


1) Create a new element with the input property of "Read-Only" or "Text Input." 

2) In the Dynamic Value of this element, place: getNextSequence() 


Helpful Hints:

1) By combining the built-in username function, you can track the sequence of the records with their username.  To do this, you follow the same steps for the getNextSequence() EXCEPT in the Dynamic Value of the element place:  iformbuilder.username + " " + getNextSeqence()

2) If you want to restart the count, you will have uninstall the app and then install it again.  This will restart every users count.**




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


  • Avatar
    Guy Swartwout

    These functions do not behave as advertised on this page. Here is the scenario. User 1 downloads record to iPad, then reassigns the record to user 2 using the Assign-to widget. He submits the data and, in the case of iformbuilder.username, his user name is uploaded to the cloud database. User 2 downloads the record and sees user 1's user name in the read-only widget.

Powered by Zendesk