Dynamic Fields
A dynamic field is a type of field in which the value of one field controls the values that a user can choose in another field. In a dynamic field, selecting a value for a parent field determines what values are available in the "child" fields. Dynamic fields can contain multiple levels (for instance, only displaying the available states or provinces for a particular country once the Country field has been filled), or can depend on more than one parent field (for instance, only displaying years relevant to a particular combination of car manufacturer and model).
Setting Dynamic Fields on Documents or Folders
Dynamic fields are set or modified just like list fields: select a value from the field's drop-down in the Fields tab. When selecting values for dynamic fields, you must assign values to them in order. In the example above, if a user tried to select a state or province before selecting a country, there would be no values available for selection. In some cases, additional fields may depend on more than one parent field (such as a "City" field that depends on both "Country" and "State or Province"), in which case all of the parent fields must be filled in before the child field can.
If a dynamic field is configured such that only one value is possible once the parent fields have been filled in, that value will automatically be filled in the child field. For example, if you have "Employee Name" and "Email Address" fields bound to the "Employee ID" field, and the "Employee ID" field is unique, the employee name and email address will automatically be populated.
Dynamic fields are configured on the repository management page. Administrators can choose exactly what values they want to include and how they want those values to be constrained or bound. Any type of field can be configured as a dynamic field.
Planning Dynamic Fields
Before you create your dynamic fields, you should plan what values you want to allow users to set dynamically. These values will be stored in an external table; see External Tables in the Laserfiche System Administration Guide.
Any collection of information where one value is associated with another can be turned into a dynamic field. You can also create dynamic fields in which one piece of information controls more than one other field. Below are some examples of this kind of information, and how you could set up your tables to reflect it.
You may want to use a dynamic field that filters a list of employees by department, so that once a department has been chosen, only those employees that are part of that department can be selected. You would begin with a list like the one below. If the following list is used in a dynamic field, for instance, when the HR department is selected, Tanya Wu and Pat Tomson would be available in the employee field, but the other employees would not be.
In some cases, you might want to link more than two pieces of information in a dynamic field. For instance, you might create a set of dynamic fields to track car manufacturers, models, and years, such that if you selected, say, Dodge as the manufacturer, only Dodge models would appear in the models list; once you'd selected Dodge and Caravan, you would then be able to select only years relevant to Dodge Caravan automobiles. You could do so with a list like the one below.
External Tables
The values of a dynamic field are stored in an external table on the same Microsoft SQL Server instance as the repository. You can create a new table to contain these values, or use an existing database that contains the necessary information. See External Tables in the Laserfiche System Administration Guide for more information.
Adding Dynamic Fields to a Template
Once you have added your dynamic field information as a lookup table, you can add the fields to a template. There are three basic steps for adding dynamic fields to a template. First, you must add the fields you want to handle dynamically to the template. Both the parent fields and the child fields must be added. Second, you must associate the fields with columns in your external table. Finally, you must specify which fields depend on which other fields.
- Open the app picker in the upper right corner, and select Repository Administration.
- Under Metadata, select Templates.
- Select the template to which you want to add dynamic fields, or create a new template. (See Creating and Modifying Template Definitions for more information on template creation.)
- Open the Dynamic Fields tab, and add a field using the Insert Field button.
- Set the properties for the dynamic field:
- In the Name option, select the field you want to manage dynamically.
- In the External table option, select the lookup table in which the information is stored.
- In the External column option, select the column that corresponds to the field you selected.
- In the Parent Fields option, select the field or fields that will determine the possible contents of this field. (If this is the field that will determine the possible contents of other fields, and is not itself bound to any other fields, leave this option blank.)
- In the Sort direction field, select Ascending or Descending.
- Optional: The Restrict values option determines the behavior of the field when accessed using the Laserfiche SDK or another application such as Quick Fields. If you select False, external applications will be able to save values to that field even if they do not exactly match the values in the external table. For example, if you have a Quick Fields session attempting to store a value obtained via OCR it would be able to save that value even if it contained a small mismatch due to an OCR inaccuracy. If you select True, the value must match the value in the external table exactly, or it cannot be saved. This value is recommended if you are using dynamic fields for data verification. If you are unsure which option to select, we recommend leaving it set to the default, False.
- Repeat step 4 for each additional field that you want to handle dynamically.
- When you are finished, save your template definition.