Structuring data for performance

Data binding options for performance

For forms that are bound to data sources, you can associate a data element with a form object, such as a field or a subform. This association is called data binding. You can choose objects that shrink or grow depending on the amount of data they display.

Many data binding definitions can produce the same results when a form is rendered. However, the more obvious the relationship between the form object and its data element, the more efficiently Forms can process the data binding.

The following diagram shows a field binding example where two field objects in the form are bound to data elements. The binding is ambiguous because multiple instances of the field objects and their data exist. More processing is required to match the nth occurrence of each object to the nth occurrence of the corresponding data when rendering the form.

View full size graphic
Field bindings(number and quantity)

The following diagram shows the use of subform binding to group objects and thereby simplify the processing to render the form. The subform is bound to the repeating group in the data, eliminating the ambiguous binding. The binding is evaluated for the first group and does not need to be re-evaluated for subsequent repetitions.

View full size graphic
A.
Field bindings(number and quantity)

B.
Subform binding

You can use subforms to group and organize objects without binding the subform to a data element. To prevent Forms from searching for a data element for the subform when merging data, change the subform’s data binding type from the default value of Normal to None.

Evaluating data structure for performance

Selective field display is one way to demonstrate how data structure affects performance.

Assume that we want to display a message only if the value of the amountOwed data element is greater than zero. One approach is to use a script to examine the value of amountOwed and alter the show/hide property of the message field, depending on the value of the data element.

Alternatively, you could bind the data to a subform. Binding data to a subform is more efficient than binding data to a field, although both methods produce the same result. Here, we add the status element to the data structure and bind this element to a subform. The subform includes the message field and the amountOwed field. With the minimum count of the subform set to zero, the message appears only if the status element exists.

In the data context, the decision to add the status node to the data file should be done at generation time, only if the value is greater than 0. This technique moves the logic to determine whether a subform is required in the data context design.

// Ethnio survey code removed