JMap Server Lima
English
English
  • Welcome to JMap Server Lima
  • Administrator
    • JMap Server Administrator Manual
      • Introduction
        • Quick Start Guide
        • User Interface
          • Old User Interface
      • Resources: Databases
        • Creating Databases
        • Configuring Databases
          • Database Permissions
        • Managing Databases
        • JMap Server System Database
      • Resources: JMap Server to JMap Server Connections
        • Creating Connections to JMap Server
        • Configuring JMap Server to JMap Server Connections
          • Permissions for the Remote Connection
        • Managing Connections
      • Resources: Spatial Data
        • Basic Concepts
        • Creating Spatial Data Sources
        • Configuring Spatial Data Sources
          • Spatial Data Source Permissions
          • External Attributes
          • Metadata
          • Sharing Spatial Data Sources
        • Managing Spatial Data Sources
        • Vector Data Sources
          • JMap ADF - E00 Arc - Info reader
          • JMap CSV reader
          • JMap DGN V7 - V8 File reader
          • JMap DWG - DXF reader
          • JMap EDIGEO reader
          • JMap File geodatabase reader
          • JMap GeoJSON reader
          • JMap GML reader
          • JMap GPX reader
          • JMap IFC reader
          • JMap KML reader
          • JMap MID - MIF reader
          • JMap Photo reader
          • JMap SHP reader
          • JMap TAB reader
          • Annotations in a database
          • ArcGIS REST
          • ArcSDE geodatabase
          • Coordinates in a database
          • Enterprise geodatabase
          • JMap Server
          • JMap Spatial Table
          • MongoDB
          • MySQL Spatial
          • OGC API Features
          • Oracle Spatial Locator
          • Personal geodatabase
          • PostGIS
          • SQL Server Spatial
          • WFS Server
          • WKB or WKT in a database
        • Raster Data Sources
          • ECW - JPG2000
          • GDAL - Geospatial Data Abstraction Library
          • ArcGIS REST
          • JMap Server
          • OpenStreetMap
          • WMS server
          • WMTS Server
      • Resources: Metadata templates
      • Resources: Projects
        • Creating Projects
          • Multilingual Projects
          • Vector tiles in JMap
        • Configuring Projects
          • Project Permissions
          • Managing Layers
            • Organizing Layers
          • Attribute Queries
            • Attribute Query Forms
          • Image Producer
          • JMap Extensions Compatible with JMap NG or JMap Survey
        • Sharing the Project
        • Managing Projects
      • Resources: Style Templates
        • Creating Style Templates
        • Managing Style Templates
      • Resources: Personal Layers
      • Resources: Layers
        • Creating Layers
        • Configuring Layers
          • Layer Permissions
          • General Settings
          • Dynamic Filters
          • Style
          • Thematics
          • Labels
          • Mouseover
          • Information Reports
          • Forms
            • Configuring Forms
            • Creating Forms
              • Layer Attributes Forms
              • Database Forms
          • JMap Extensions
        • Sharing Layers
      • JMap Server Applications
        • Deployment: Classical JMap applications
          • JMap Pro Applications
          • JMap Web Applications
            • Using a GeoWebCache Server
          • WFS and WMS Services
          • Managing Deployed Applications
          • Downloading Services
        • New generation JMap applications
      • Tools
        • SQL Console
        • Import / Export
          • User Data
        • Scheduler
        • Messaging
        • Debugging tools
      • JMap Server Extensions
        • Installed Extensions
        • Marketplace
      • JMap Server
        • JMap Server Status
        • Sessions
        • Security
          • Users and Groups
            • User Managers
              • JMap DB user manager
              • Composite user manager
              • Active Directory user manager
              • JMap LDAP user manager
              • OpenID Connect (OIDC) user manager
              • SAML2 user manager
            • Single Sign-On for JMap Pro
          • Managing Permissions
          • Using HTTPS with JMap
        • Log Files
        • Usage Statistics
        • JMap Server Settings
    • Technical Specifications
    • Installation Guide
    • Installing and Starting JMap Server (with installer)
    • Installing and Starting JMap Server (in a Docker container)
    • Migration Guide to JMap Server Lima
  • Applications
    • JMap Server Applications
    • JMap Pro User Guide
      • Introduction
        • User Interface
        • Navigating on the Map
        • Map Management
        • Map Settings
      • Map Layers
        • Layer Management
        • Elements Explorer
        • Thematic Maps
        • Layer Metadata
        • Layer Settings
          • General
          • Style
          • Thematics
          • Labeling
          • Mouseover
          • Filters
          • Advanced
        • Editable Layers
          • Editing Data
          • Personal Layers
      • Tools
        • Labeling
        • Interactive Selection
        • Information
          • Information Report
          • Geometry Information
          • Mouseover
        • Snap
        • Measurement
        • Search Tools
          • Attribute Queries
          • Spatial Queries
        • Collaboration Tools
          • Map Contexts
          • Sharing Maps
          • Printing Maps
      • Application Settings
      • Keyboard and Mouse Shortcuts
    • JMap NG User Guide
      • Introduction
        • Connecting to JMap NG
        • User Interface
        • Navigating on the Map
        • Profile and User Settings
      • The Data
        • The Layers Panel
        • Data Layers
          • Displaying Layers
          • Thematics
          • Layer Information
          • Geographic Extent of the Layer
          • Filter Elements on the Map
          • Making Layer Elements Selectable
      • I Wish to...
        • Display Element Information
          • Tooltips
          • Information Reports
        • Perform Searches
        • Select Elements on the Map
        • Measure Distances and Surfaces
        • Add Annotations to the Map
        • Edit Data
        • Create and Manage Customized Maps
        • Export / Print a Map
    • JMap Survey User Guide
      • Introduction
        • Working With an iOS Device
        • Working With an Android Device
        • Logging In
        • User Interface
      • The Data
      • I Wish to...
        • Access Information Associated With an Object
        • Perform Searches
        • Create Objects
        • Modify Objects
        • Work in Offline Mode
        • Synchronize Data with JMap Server
        • Log Out
    • JMap Web
      • JMap Web User Guide
  • Extensions
    • Edition
      • User Interface
      • Basic Concepts
      • I Wish to...
        • Edit Layers Geometries
          • Edition Tools
          • Selecting Elements
          • Node and Polygon Operations
          • Vertical Position and Element Duplication
          • WKT Geometries
        • Perform Spatial Operations
          • Geoprocessing
          • Spatial Tools
    • Export
    • Import
      • Importation Procedure
        • Importing MIF Files
        • Importing SHP Files
        • Importing CSV Files
        • Importing NMEA Data
        • Importing Data From WMS
    • Documents
      • Configuring JMap Documents
        • Selecting Data Sources to Associate Documents with
        • Configuring Document Depots
        • Managing repositories
        • Making Documents available in apps
      • Documents for JMap Pro
        • Graphical Interface
        • Associating Documents with Map Elements
        • Searching for Documents
        • Displaying the List of Documents Associated with Elements
      • Documents for JMap NG
        • Graphical Interface
        • Searching for Documents
        • Showing Selected Documents
      • Documents for JMap Survey
    • Tracking
      • Administrator
      • User
    • JMap NG Configuration
      • Configuration
  • Developer
    • JMap Server REST API
    • JMap Admin REST API
    • JMap Pro / Server API
    • JMap Web API
    • JMap Server SDK
    • JMap NG Developer Manual
      • Startup Options
      • Extensions
      • Examples
        • Start the JMap NG Core library
        • Start the JMap NG App
        • Add a JMap NG App extension
        • Toggle a JMap layer visibility
        • Add a layer to display custom data from GeoJSON file
        • Locate and select features by attribute query
        • Add an event on move end
        • Add attributions on the map
        • Locate and select feature by id
        • Locate and select feature(s) by location
        • Custom mouseover on a layer
        • Create a custom form in a div
      • Changelog
  • Knowledge Base
    • Knowledge Base
Propulsé par GitBook

K2 Geospatial 2024

Sur cette page
  • Creating a database form
  • SQL Query Syntax
  • Form properties
  • Subforms
  • Creating a subform
  • Nested subforms
  • Permissions of database forms
Exporter en PDF
  1. Administrator
  2. JMap Server Administrator Manual
  3. Resources: Layers
  4. Configuring Layers
  5. Forms
  6. Creating Forms

Database Forms

PrécédentLayer Attributes FormsSuivantJMap Extensions

Dernière mise à jour il y a 7 mois

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 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, in the Form section of the Forms tab of the layer configuration interface, press 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.

SQL Query Syntax

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.

ev(attrib) or elementValue(attrib)

This function returns the value of the attribute specified as a parameter for an element.

Example

ev(city);

Returns the value of the element’s CITY attribute.

fv(field) or formValue(field)

This function returns the value in the form for the field specified as a parameter.

The name of the table must be the prefix of the field name.

Example

fv(table.name);

Returns the value entered in the form component associated with the TABLE.NAME field of the database.

ei() or elementId()

This function returns the id of the element. It can be the jmap_id field, or another field, as configured in the spatial data source.

$variable

Allows you to create and initialize variables that can be used in the various expressions.

For the INSERT query of a form, a variable containing the unique identifier of the inserted record must be used.

Example

$city = EV(city);

Creates a $city variable initialized with the value of the element’s CITY attribute.

nti(table, field) or nextTableId(table, field)

This function returns the next value to use as a numeric identifier for the table and field specified as parameters.

The specified field must exist in the specified table and must be an integer field.

The function determines the maximum value existing in the table and returns this value incremented by 1 (max + 1).

This function is useful when adding a new record in the database when the table has a unique identifier.

Example

$id = nextTableId(inspections, inspection_id)

Creates and initializes a $id variable with the value of the next INSPECTION_ID identifier in the INSPECTIONS table. If the maximum value present is 100, the value returned is 101.

Form properties

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

Database

Select the database containing the data that must be managed by the form.

SELECT query

The SQL query that provides the data used to populate the form fields.

All the fields that are returned by this query can be used to configure the form’s components and also within other queries defined in the form using the fv()function. The query must contain a condition to link a layer attribute with a database field.

Example of a query for a database form (1 to 1):

SELECT * FROM ASSET_INFO WHERE ASSET_ID = EI();

In this example, all the fields of the ASSET_INFO table are obtained and available to configure the form components.

The ASSET_ID field is used to link towards the element of the ASSETS layer using the ei() function. If the ei() function returns a value in text format, you must place the statement between apostrophes to view the value:

SELECT * FROM ASSET_INFO WHERE ASSET_ID = 'EI()';

Example of a query for a database form (1 to N):

  • Example with the Inspections subform:

SELECT * FROM INSPECTION WHERE ASSET_ID = EI();

In this example, all the fields of the INSPECTION table are obtained and available to configure the subform’s components. The ASSET_ID field is used to link towards the element of the ASSETS layer using the ei() function.

If the ei() function returns a value in text format, you must place the statement between apostrophes to view the value:

SELECT * FROM INSPECTION WHERE ASSET_ID = 'EI()';

  • Example with the Inspectors nested subform:

SELECT * FROM INSPECTOR WHERE INSPECTION_ID = FV(INSPECTION_ID);

In this example, all the fields of the INSPECTOR table are obtained and available to configure the subform’s components. The INSPECTION_ID field is used to link towards the element of the INSPECTION table using the fv(field) function.

  • Example with Interventions nested subform:

SELECT * FROM INTERVENTION WHERE INSPECTION_ID = FV(INSPECTION_ID);

In this example, all the fields of the INTERVENTION table are obtained and available to configure the subform’s components. The INSPECTION_ID field is used to link towards the element of the INSPECTION table using the fv(field) function.

Field of the unique identifier

The SELECT query must include a unique identifier field (numeric or alphanumeric). Select the field that must be used as a unique identifier.

  • Example of a query for a database form (1 to 1): ASSET_INFO.ASSET_ID

  • Example of a query for a database form (1 to N), Inspections subform: INSPECTION.INSPECTION_ID

  • Example of a query for a database form (1 to N), Inspectors nested subform: INSPECTOR.INSPECTOR_ID

  • Example of a query for a database form (1 to N), Interventions nested subform: INTERVENTION.INTERVENTION_ID

INSERT query

SQL query that inserts new data in the database.

Configure this query only if the form must allow records to be added to the database.

You must define a variable that contains the value of the unique identifier for the new record.

Example of a query for a database form (1 to 1):

$id = ei(); INSERT INTO ASSET_INFO (ASSET_ID, ASSET_YEAR, BRAND, ASSET_HEIGHT) VALUES (EI(), FV(ASSET_INFO.ASSET_YEAR), FV(ASSET_INFO.BRAND), FV(ASSET_INFO.ASSET_HEIGHT));

In this example, the data of the form is inserted in the ASSET_INFO table when the INSERT SQL query is executed. The values of the ASSET_INFO.ASSET_YEAR, ASSET_INFO.BRAND and ASSET_INFO.ASSET_HEIGHT fields are provided by the values entered in the form using the fv(field) function.

The value of the ASSET_INFO.ASSET_ID variable is provided by the ei() function.

Example of a query for a database form (1 to N):

  • Example with Inspections subform:

$id = nti(INSPECTION, INSPECTION_ID);

INSERT INTO INSPECTION (INSPECTION_ID, ASSET_ID, INSP_DATE, INSP_COMMENT) VALUES ($id, EI(), FV(INSPECTION.INSP_DATE), FV(INSPECTION.INSP_COMMENT));

In this example, a $id variable is created and initialized with the next value (max + 1) of the ID field from the INSPECTION table. The form data is inserted in the INSPECTION table when the SQL INSERT query is executed.

The values of the INSP_DATE and INSP_COMMENT fields are provided by the values the user entered in the subform using the fv(field) function.

The value of the INSPECTION_ID field is provided by the $id variable.

The value of the ASSET_ID field is provided by the ei() function.

  • Example with Inspectors nested subform:

$id = nti(INSPECTOR, INSPECTOR_ID);

INSERT INTO INSPECTOR (INSPECTOR_ID, INSPECTION_ID, CONTACT_INFO, TEAM) VALUES ($id, FV(INSPECTOR.INSPECTION_ID), FV(INSPECTOR.CONTACT_INFO), FV(INSPECTOR.TEAM));

In this example, a $id variable is created and initialized with the next value (max + 1) of the ID field from the INSPECTOR table. The form data is inserted in the INSPECTOR table when the SQL INSERT query is executed.

The values of the INSPECTION_ID, CONTACT_INFO and TEAM fields are provided by the values the user entered in the subform using the fv(field) function.

The value of the INSPECTOR_ID field is provided by the \$id variable.

  • Example with Interventions nested subform:

$id = nti(INTERVENTION, INTERVENTION_ID);

INSERT INTO INTERVENTION (INTERVENTION_ID, INSPECTION_ID, WORK_ORDER, FOLLOW_UP) VALUES ($id, FV(INSPECTION_ID), FV(INTERVENTION.WORK_ORDER), FV(INTERVENTION.FOLLOW_UP));

In this example, a $id variable is created and initialized with the next value (max + 1) of the ID field from the INTERVENTION table.

The form data is inserted in the INTERVENTION table when the SQL INSERT query is executed.

The values of the INSPECTION_ID, WORK_ORDER and FOLLOW_UP fields are provided by the values the user entered in the subform using the fv(field) function.

The value of the INTERVENTION_ID field is provided by the $id variable.

Variable with the ID of the new element ()

Select the variable containing the value of the unique identifier of the new record inserted in the table. It must be defined with the INSERT query. In order for your data to be recorded in the database (the photos, for example), you must define and select this variable.

  • Example of a query for a database form (1 to 1): $id

  • Example of a query for a database form (1 to N), Inspections subform: $id

  • Example of a query for a database form (1 to N), Inspectors nested subform: $id

  • Example of a query for a database form (1 to N), Interventions nested subform: $id

UPDATE query

SQL query that updates the data in the database. Configure this query only if the form must allow data to be updated. Example of a query for a database form (1 to 1):

UPDATE ASSET_INFO SET ASSET_YEAR = FV(ASSET_INFO.ASSET_YEAR), BRAND = FV(ASSET_INFO.BRAND), ASSET_HEIGHT = FV(ASSET_INFO.ASSET_HEIGHT) WHERE ASSET_ID = FV(ASSET_INFO.ASSET_ID);

In this example, the form data is used to update the ASSET_INFO table when the UPDATE SQL query is executed. The values of the ASSET_YEAR, BRAND, and ASSET_HEIGHT fields are provided by the values the user entered in the form using the fv(field) function.

The WHERE clause allows you to update the record containing the element’s unique identifier, ASSET_ID, also using the fv(field) function.

Example of a query for a database form (1 to N):

  • Example with Inspections subform:

UPDATE INSPECTION SET INSP_DATE = FV(INSPECTION.INSP_DATE), INSP_COMMENT = FV(INSPECTION.INSP_COMMENT) WHERE INSPECTION_ID = FV(INSPECTION.INSPECTION_ID);

In this example, the subform data is used to update the INSPECTION table when the UPDATE SQL query is executed. The values of the INSP_DATE and INSP_COMMENT fields are updated, and they are provided by the values the user entered in the form using the fv(field) function.

The WHERE clause uses the fv(field) function to retrieve the value of the record’s unique identifier.

  • Example with Inspectors nested subform:

UPDATE INSPECTOR SET CONTACT_INFO = FV(INSPECTOR.CONTACT_INFO), TEAM = FV(INSPECTOR.TEAM) WHERE INSPECTOR_ID = FV(INSPECTOR.INSPECTOR_ID);

In this example, the subform data is used to update the INSPECTOR table when the UPDATE SQL query is executed. The values of the CONTACT_INFO field are updated, and they are provided by the value the user entered in the form using the fv(field) function.

The WHERE clause uses the fv(field) function to obtain the value of the record’s unique identifier.

  • Example with Interventions nested subform:

UPDATE INTERVENTION SET WORK_ORDER = FV(INTERVENTION.WORK_ORDER), FOLLOW_UP = FV(INTERVENTION.FOLLOW_UP) WHERE INTERVENTION_ID = FV(INTERVENTION.INTERVENTION_ID);

In this example, the subform data is used to update the INTERVENTION table when the UPDATE SQL query is executed. The values of the WORK_ORDER and FOLLOW_UP fields are updated, and they are provided by the value the user entered in the form using the fv(field) function.

The WHERE clause uses the fv(field) function to obtain the value of the record’s unique identifier.

DELETE query

This SQL query deletes the data from the database.

Only configure this query if the form must allow data to be deleted.

Example of a query for a database form (1 to 1):

DELETE FROM ASSET_INFO WHERE ASSET_ID = FV(ASSET_INFO.ASSET_ID);

In this example, the record corresponding to the element’s ASSET_ID attribute value is deleted from the ASSET_INFO table using the fv(field) function to obtain the value of the element’s identifier.

Example of a query for a database form (1 to N):

  • Example with Inspections subform:

DELETE FROM INSPECTION WHERE INSPECTION_ID = FV(INSPECTION.INSPECTION_ID); DELETE FROM INTERVENTION WHERE INSPECTION_ID = FV(INSPECTION.INSPECTION_ID); DELETE FROM INSPECTOR WHERE INSPECTION_ID = FV(INSPECTION.INSPECTION_ID);

In this example, the record corresponding to the inspection’s unique identifier is deleted from the table using the fv(field) function to obtain the value of the identifier.

The records of the INTERVENTION and INSPECTOR nested subforms that correspond to the inspection’s unique identifier are also deleted from the table when the inspection is deleted.

  • Example with Inspectors nested subform:

DELETE FROM INSPECTOR WHERE INSPECTOR_ID = FV(INSPECTOR.INSPECTOR_ID);

In this example, the record corresponding to the inspector’s unique identifier is deleted from the table using the fv(field) function to obtain the value of the identifier.

  • Example with Interventions nested subform:

DELETE FROM INTERVENTION WHERE INTERVENTION_ID = FV(INTERVENTION.INTERVENTION_ID);

In this example, the record corresponding to the intervention’s unique identifier is deleted from the table using the fv(field) function to obtain the value of the identifier.

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, open the Subform tab on the Forms tab in the layer parameters menu, 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.

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. The Permissions button appears in the form configuration interface.

The Permissions section has two tabs: Permissions and Owners. The owners are the only ones who can manage the administrative permissions for the project, manage the list of owners and delete it.

Available permissions are described in the table below.

Add data

Allows a user or group to use the form to add new data in the database.

Modify data

Allows a user or group to use the form to modify existing data in the database.

Delete data

Allows a user or group to use the form to delete data existing in the database.

Creating a nested subform is done by following the same steps to . Examples of queries are displayed in the table of the section.

A list of users and groups with permissions appears in the Permissions tab. Click on to add new users or groups.

Available users and groups are configured in the JMap Server section of JMap Admin. Refer to the section for more information about managing users in JMap Server.

Users and Groups
create a subform
Creating a database form
subforms
Database forms use a common field to manage data external to JMap that is related to the layer.
Subforms are database forms that use a common field to manage data with a 1 to N relationship with the layer data.
Nested subforms are database forms that are used to manage data having a 1 to N relationship with the subform’s data using a common field.