Datasets

Datasets are metadata to be used in forms. They can be maintained through dataset maintenance in the Smartflow portal or imported from external systems through the Smartflow Web API. A few examples of a dataset are a list of equipments to be displayed in a drop-down in a form or a dynamic set of questions for an inspection checklist.

Technically, a dataset is a a container that holds items in a defined structure. The structure of a dataset is defined as dataset field definitions.

For example, an Equipments dataset may be defined with fields definitions as EquipmentNumber (number), EquipmentName (text) and CommissionDate (date). Each item in the dataset should contain data in these fields along with a unique code.

A dataset is used by binding it to a form control. When a dataset is bound to a form control, the items in the dataset are populated in the form control, subject to dataset distribution query.

Properties

Property

Description

Property

Description

Source type

Type of dataset (standard or virtual)

Name

Name of the dataset. It must be unique in a domain.

Key field

Field in the dataset definition that should be treated as the key. “Code” is the default key field.

Display field

Field in the dataset definition that should be displayed in form controls where the dataset is used.

Priority

Defines the priority in downloading the dataset to mobile apps.

  • High priority datasets are considered essential data and downloaded in mobile apps soon after a user logs in. Users cannot use the apps until high priority datasets are present in the device.

  • Medium and Low priority datasets are downloaded in background. Users can use the apps while the datasets are being downloaded to the device.

RefExternal

External reference of the dataset. It is usually the identifier from external systems from which the dataset has been imported into Smartflow.

Delete expired items

Indicates if dataset items should be removed from the server and the users' devices after they expire.

Removing expired dataset items will cause form fields to be shown as empty if they are used in existing forms. Items should be removed only if they are not used in forms or the forms in which they are used are not relevant anymore.

Delete in app only

Indicates if expired dataset items should be removed only from users' devices and not from the server.

Types of datasets

There are four types of datasets in Smartflow.

Standard datasets

Standard datasets are defined and maintained through dataset maintenance on the Smartflow portal. A standard dataset is defined through field definitions. Items in the dataset can be added and maintained in the Smartflow portal or imported from external systems through the Smartflow Web API.

Standard datasets can be re-used in multiple forms as well as in multiple controls inside a form.

Virtual datasets

Unlike standard datasets, virtual datasets do not exist physically on the server. Virtual datasets are defined as SQL queries on form data. The fields resulting from the query are considered as field definitions of the dataset. Items in the dataset are fetched runtime by executing the query and hence, cannot be added or modified independently.

Virtual datasets can be re-used in multiple forms as well as in multiple controls inside a form.

Virtual datasets are designed by Smartflow support team on request.

Form template specific datasets

Form template specific datasets are created internally when a user adds options in multiple choice controls when designing a form in the builder. They are bound to a specific form control of a form. They can be maintained through the form control and are not visible in dataset maintenance on the Smartflow portal.

Each multiple choice control creates its own dataset if the options are added through the builder. If multiple forms or multiple controls in a form share the same set of options, it is recommended to create a standard dataset and re-use it, to gain better performance.

System datasets

System datasets are pre-defined datasets in Smartflow system. They are maintained internally by the system and can be used in forms. “Users” is a system dataset that exposes the list of users in the domain.

System datasets can be re-used in multiple forms as well as in multiple controls inside a form.

Key field and Display field

The key field is one of the fields in the dataset definition that uniquely identifies an item in the dataset. The value in the key field is stored as data in forms and established the link between a form field and the selected dataset item. The key field is also used for communication in the Web API.

  • In standard datasets, “Code” is considered as the key field.

  • In virtual datasets, one of the fields resulting from the query should be defined as the key field.

The display field is one of the fields in the dataset definition that is visible to users when the items are listed in a form control. Any existing dataset field can be chosen as the display field for the dataset.