Database Forms

Database forms are used to manage data stored in databases that are external to JMap. They allow you to add new data as well as modify or delete existing data. You can create several database forms for one layer. Each database form has its own permissions to control which users can make changes to the data.

These forms can be used to manage data using a 1 to 1 relationship with a layer’s data. In this case, a record is added when an element is created, and this record is usually deleted when the element is deleted.

They can also be used to manage data using a 1 to N relationship with the layer data. In this case, a special type of form called a subform is used and is always associated with a table form component. Refer to the subforms section for more information on this topic.

Configuring this type of form is an advanced JMap function that requires writing SQL queries to extract, add, modify and delete data.

Creating a database form

To create a database form, select Forms in the layer parameters menu. Make sure you open the Forms tab, then click on Create.

You must enter a name for the new form. Afterwards, you must select the type of form to create, Database, then select the database containing the data to be used in the forms.

At the following step, a window allows you to enter the form’s SQL queries. These queries are used to extract, add, modify, and delete data. The SELECT query is required, but the others are optional. Only operations for which SQL queries have been provided can be performed.

A special syntax is used for SQL query configuration. In general, each line of this syntax must end with a semicolon (;). The syntax is not case sensitive.

The following table provides a detailed explanation of how this syntax works.

The following table provides a detailed explanation of each parameter in the database form creation window.

Subforms

Subforms are database forms that are opened from a Table component that exists in another form. They are normally used to manage data that has a 1 to N relationship with the layer’s elements. They could be used to manage data for inspections on assets (N inspections can be associated to the same object), for example. They are configured similarly to the other database forms.

Creating a subform

To create a subform, select Forms in the layer parameters menu. Make sure you open the Subform tab, then click on Create. You must enter a name for the new form and select the database containing the data to be used in the forms.

At the following step, you must configure the SQL queries of the subform, as explained above for the creation of a database form.

Nested subforms

Several levels of subforms can be nested in a subform. They are used to manage data having a 1 to N relationship with the subform’s records. For example, they can be used to manage the data of interventions arising from an inspection performed on an asset (N interventions can be associated with 1 inspection). A nested subform is opened from a Table component found in the subform it is associated with. Creating a nested subform is done by following the same steps to create a subform. Examples of queries are displayed in the table of the Creating a database form section.

The following figure shows a preview of the nested subforms from our example, in JMap Pro.

Permissions of database forms

Database forms have their own permissions. Available permissions are described in the table below.

Form validation rules

Layer attribute forms and database forms and subforms allow you to define global form validation rules based on multiple fields. You can also define validation rules at the component level.

The rules validate the values of the fields on the client side, that is, the values that the users of JMap applications enter in the forms. The validation takes place when the form is saved, which is not done if the rules are not respected.

To configure the rules of a form or a subform, open the configuration interface of the form or subform that interests you:

  1. Press Create. The window for creating a rule is displayed.

  2. Press Save.

You can create multiple rules for the same form.

Dernière mise à jour

K2 Geospatial 2022