Array Controls

When configuring a form, controls can be placed into a dynamic list, known as an array. An array consists of Form controls placed in a single table row, with array boundary controls at the beginning and end of the table row. At run-time, users can dynamically add or remove rows from the array. A control placed inside an array will always return the values entered into that field in a comma-separated list. For instance, a field inside an array that contains three rows might return the string "Value1,Value2,Value3" as the value of the array control. The value of a specific row in an array can also be retrieved as a single value through the use of the array row's index (ROW_NUM). Please see the Parameters topic of the system variables guide for more information on extracting an array row value using the ROW_NUM formatter.

Array Data, Conditions, and Validation #

Set Form Data

When using Array Form fields in the Set Form Data tab of a Form Definition, an additional text box will be displayed to the right of the array field name to enable you to enter a specific row number. By default, this field is blank, and the field value will return all of the values in that array field as a comma-separated list.

You can specify a specific row to change by entering the row number in this text box, e.g.:

In the example above, the data would be set only in the second row of the array. Arrays rows are 1-based, which is to say that the first row of the array starts at the number 1.

Conditions

In the Condition Builder, using an array field will, by default, try to evaluate the entire contents of an array field, meaning the entire list of field values will be returned in a single string, as a comma-separated list. You can, however, evaluate a single array value by using a Form field System Variable with the syntax:

{FORM:SomeFieldName, ROW_NUM=2}

In this case, you won't be able to select the Form Field menu item of the Choose System Variable dialog box to specify the field. Instead, you'll need to use the Value > String menu item, and inter the System Variable on the left side of the condition.

You can enter the System Variable as the string value and, at run-time, the system will use only the value from the specified row of the array to use in the comparison. The condition row in the Condition Builder will then appear similar to the example below.

Arrays can, of course, have any number of rows, so, if you use a specific row number, be aware that the specified row may not actually exist in the array. You can, however, always access the last row in an array using the System Variable syntax:

{FORM:SomeFieldName, ROW_NUM={NUM_ROWS}}

The {NUM_ROWS} system variable always returns the number of rows in an array, and thus can always be used as a pointer to the last array row, irrespective of how many rows the array contains.

Validation

Array fields can be used in validation conditions, but you should be aware that complex conditions may not return the results you expect, because Process Director will evaluate each element of a complex condition separately. For instance, let's say that you have two columns in an array that contain the following values.

COLUMN 1 COLUMN 2
3 ABC
1 DEF

If you set a complex condition, such as, Column 1 = "3" AND Column 2 = "DEF", the condition will return "True", even though the values you're looking for don't exist in the same row.

A more comprehensive look at array conditions is presented in the Using Arrays in Conditions section of the Condition Builder topic.

Row numbers for an array row can also be accessed via the Row Number System Variable.

Other Control Tools

You can view the documentation for all tools available in the Online Form Designer by using the Table of Contents on the upper right corner of the page, or by clicking one of the links below.

Basic Controls: The most commonly-used form design tools.

 Input Controls: Controls that are commonly used to collect data, but are a bit less widely used than the basic controls.

Other Input Controls: Additional Input controls, consisting mainly of the different content picker controls.

Actions: These controls enable you to control form actions, like placing buttons, or choosing objects via a picker,

Other Controls: Controls that perform miscellaneous tasks like adding HTML content, or labels.

Layout: Controls that are used to govern the control layout for the template, such as tabs and sections.

Responsive Layout: Controls that implement Bootstrap form layout objects.

Attachments: Controls that enable you to add and show attachments, such as documents or images, to the Form.

Data List (v6.0.100 and higher): Controls that enable the display of tabular data on a Form.

Form Control Tags: System Variables used to add controls to a Form, instead of using the UI controls.