Component: Form management - Data management
Introduction
Data management provides an efficient way to organize the interaction between Form and Casewhere data models. The form admin can configure the field mappings between Casewhere data models and the Form, in which the data model defines the data object's structure and the Form determines how the data object looks like to the user.
Once the mapping has been configured, the data object can be created, read, deleted, and queried via the Form.
This article will show you how to manage the data models as well as how to use them in the Form builder.
Guideline
Form data sources
The Form data sources page is used to manage the data sources which are used for building the forms.
The Form data source is configured based on the original data sources in admin site. Instead of using all attributes from the original data sources, you can customize the form data source according to the using purpose.
The data sources are displayed on the list with the basic information, like: Name, Data source, and Mapping fields. In those, Data source is name of the original data source from admin site, Mapping fields is list of the custom field of the form data source.
Add new form data sources
First, click on the Add button to open the Add Form Data Source dialog.
The dialog includes the following fields:
Name
- This field is required.
- Form data source name must be unique and must not contain space and special character.
Data source
- This field is required.
- You must select a data source from the list. List of data sources is retrieved from the Data sources page in admin site.
Data source fields
- Data source fields section is only displayed after the Data source is selected
- After the data source is selected, by default, the corresponding list of attributes will be displayed in the System fields section except for some CW built-in fields.
- The section includes 2 parts, those are System fields, and Custom fields
System fields
The system fields are displayed with the information, like: Attribute name, Attribute title, Data type, and Field type. Additional information about the attribute is displayed in the Configure System Field dialog which is opened via the Edit button at the right of each row.
The available actions in System fields section are:
- Add system field from CW data source
- Edit field type for the system field
- Configure additional information of the system field
- Remove system fields from the form data source
- Reset all changes made on the system fields list
Add system field from CW data source
After the CW data source is selected, all the system fields (except for the CW built-in ones) under it will be displayed at the System fields list. You can manually add the built-in fields, or add the removed fields back.
By clicking on the Add button, an additional row for new system field will be displayed. You must select the field in Attribute name column and select the Field type for the field.
You can only add new attribute into the form data source if required information of all existing system fields in the form data source has been filled.
Edit field type for the system field
Each system field must have the data type, you can select field type at the Field type column.
If the data type of the system field already had the mapped field type in Type mappings page, the field type will be pre-filled. If the data type does not have mapped field type in Type mappings page, the field type will be empty and you must select field type.
You can also edit the field type for system field via the Configure system field dialog.
Configure additional information of the system field
By clicking on the Edit button at each field row, the Configure system field dialog of the system field will be opened.
The dialog includes 2 tabs: General, and Advanced.
General tab
- General tab is available for all data types. The tab includes the following fields:
- Attribute name
- This field is pre-filled and read-only.
- Attribute title
- This field is pre-filled and read-only.
- Description
- You can describe more about the system field via this field.
- Data type
- This field is pre-filled and read-only.
- Field type
- If the field type was filled in the System fields list, the value will be displayed properly in the dialog.
- You can change the field type for the system field.
- Attribute name
- General tab is available for all data types. The tab includes the following fields:
Advanced tab
The Advance tab includes the advanced settings for some specific data types including Array, Enum, and Foreign Key.
Array data type
- To the Array data type, the Advanced tab includes a field called Element type.
- Value of Element type field is pre-filled and cannot be changed.
Enum data type
- To the Enum data type, a list of pre-defined Enum values will be displayed in the Advanced tab.
- Foreign Key data type
- The Advanced tab includes 2 fields: Data class, and Display attribute.
- These fields are pre-filled and read-only.
Remove system fields from the form data source
- Remove each system field
- You can remove system field one by one by clicking on the Remove button at the field row.
- After being removed, the field will be hidden from the System fields list. To add the field again, you must add it manually.
- The field is only removed from the form data source and will not be removed from CW data source.
- Remove all fields
- You can remove all fields at once by clicking on the Remove all button.
Reset all changes made on the system fields list
By clicking on the Reset button, all system fields (except for the CW built-in ones) under the selected data source will be displayed in System fields list.
Custom fields
Besides the list of system fields retrieved from CW data source, you can also add custom fields to be used in building the form.
The Custom fields list includes all created custom fields under the selected data source.
The custom fields are displayed with the information, like: Attribute name, Attribute title, Container, Data type, and Field type.
The available actions in Custom fields section are:
- Add new custom field
- Edit custom field
- Configure additional information of the custom fields
- Remove custom fields
Add new custom field
By clicking on the Add button, new row of the custom field will be displayed in the Custom field list with the following fields:
Attribute name
- This field is required.
- The Attribute name must be unique.
- The Attribute name must not contain spaces and special characters.
Attribute title
- This field is required.
- The Attribute title is used as displayed name for the field in building form.
Container
- This field is required.
- You must select an item from the list. List of container includes the field with Object data type belonging to the selected data source.
- The submitted data of the custom fields via form submission will be stored in the container.
Data type
- This field is required.
- You must select a data type for the custom field.
- List of the data types is pre-defined with 12 types. Those are: Array, Boolean, DateTime, Document, Double, Enum, ForeignKey, Guid, Integer, Long, Object, and String.
Field type
- This field is required.
- You must select a field type that works properly with the selected data type of the custom field.
- List of the field types is pre-defined with 17 field types. Those are: Checkbox**, Text field, Text area, Number, Password, Select box, Select, Radio button, Email, Url, Phone number, Date/Time, Day, Currency,** and File.
Edit custom field
You can edit the custom field directly in the Custom fields list for fields:
- Attribute name
- Attribute title
- Container
- Data type
- Field type
Configure additional information of the custom fields
By clicking on the Edit button at each field row, the Configure custom field dialog will be opened.
The dialog includes 2 tabs: General, and Advanced.
General tab
- The General tab is available for all data types.
- The tab includes the basic information of the custom field similarly to the Custom fields list, like: Attribute name, Attribute title, Container, Data type, Field type. All these fields are editable.
- Besides that, you can also describe more about the custom field via the Description field.
Advanced tab
The Advance tab includes the advanced settings for some specific data types including Array, Enum, and Foreign Key.
Array data type
- To the Array data type, the Advanced tab includes a field called Element type.
- The Element type list includes a list of 11 data types. You must select a data type for the elements of the array. For example, it is a document field in a form which allows uploading multiple files. So, the data type of the custom field must be Array, and its element data type must be Document.
- If the Element type is Foreign key, you must select the Data class and Display attribute for the element.
- If the Element type is Enum, you must define a set of Enum values for the element.
Enum data type
- In case data type of the custom field is Enum, in the Advanced tab, you must define the set of Enum values.
- In the tab, it is a list with 2 columns to input the value for: Label, and Value.
- Label is used as displayed name of the Enum value on UI of the rendered form.
- Value is used as saved data in backend. Value must not contain spaces, and special characters.
- For example, it is a field called Industry in an application form. The field is a dropdown list field with values, like: Agriculture, Resource, Engineering and high-tech. So, when configuring the custom field, the field should have Enum data type, Select field type. And in advanced settings, it should have the Enum values as the following:
- (Label) Agriculture, (Value) agriculture
- (Label) Resource, (Value) resource
- (Label) Engineering and high-tech, (Value) engineeringAndHightech
Foreign Key data type
- The Advanced tab includes 2 fields: Data class, and Display attribute.
- Data class
- You must select a data class from the list. List of data classes is retrieved from the Data class page in admin site,
- Display attribute
- You must select an attribute from the list. The list includes all attributes belonging to the data class. List of attributes is only enabled after the data class is selected.
- Data class
- The Advanced tab includes 2 fields: Data class, and Display attribute.
Remove custom fields
Remove each field
- You can remove each custom field by clicking on the Remove button at the field row.
- After being removed, the field will be hidden from the Custom fields list. The removed custom field will never be able to use again, however, if it is any submitted data for the field, the data will be stored in the relevant container.
Remove all custom fields
- You can also remove all fields at once by clicking on the Remove all button.
Edit form data sources
By clicking on the Edit button, the Edit form data source dialog will be opened.
The dialog includes 3 parts:
- Configuration section for Name of form data source, CW data source selection
- Data source system fields
- In this section, the available actions are:
- Add system field from CW data source
- Edit field type for the system field
- Configure additional information for the system field
- Remove system field from the form data source
- Reset the list of system fields
- Sync latest changes on system fields from the CW data source
- In this section, the available actions are:
- Data source custom fields
- In this section, the available actions are:
- Add new custom field
- Edit custom field
- Configure additional information for the custom field
- Remove custom field from the form data source
- In this section, the available actions are:
Most of the actions are similar to the corresponding actions in the flow of adding new form data source. Only the Sync latest action is different, and it will be mentioned in the following section.
Sync latest changes on system fields from the CW data source
By clicking on the Sync latest button, the syncing between CW data source and form data source is executed based on the Attribute name.
The syncing rules are:
- If the attribute name exists in CW data source and has not been added to the form data source yet, after syncing, the system field with the corresponding attribute name will be added to the Form data source.
- If the attribute name no longer exists in the CW data source and the relevant system field exists in the form data source, after syncing, the field will be removed from the form data source.
- If the attribute name exists in CW data source and the related system field was removed from the form data source, after syncing, the field will not be added to the form data source again.
If the attribute name is changed, after syncing, the relevant system field will be added to the form data source as a new field. Meanwhile, the field with old name will be also removed from the form data source according to the 2nd rule above.
Delete form data sources
The Delete button is only enabled after a form data source is selected.
By clicking on on the Delete button, the deletion confirmation dialog will be opened.
- If you select the Cancel button, the deletion will be cancelled.
- If you select the Delete button, the validation for in-use form data source will be executed.
- If the form data source is not used anywhere, the form data source will be deleted immediately.
- If the form data source is in use, the deletion will be disallowed, and an error message will be displayed.