Table of Contents |
---|
Overview
MobileMap uses business rules to enforce business logic when creating and editing feature data. Esri data models already support some business rules through the data type, domains and nullable status of a field. MobileMap business rules extend the Esri data model by adding support for more complex business logic including validation rules and field relationships.
Validation Rules (Rules) utilize “if/then” logic (e.g., "if a tree has a broken top, a height measurement is required"). Rules implemented by creating records in a specific table named 'Rules' which is included in the feature service used by MobileMap when collecting data. See the Data Model section below for a description of the fields in the Rules table.
Field relationships (Related Domains) restrict choices in one attribute field based on the values selected in a related attribute field (e.g., if Plot Type is 'Variable Radius', Plot Size options should only include variable radius plot sizes and NOT fixed area plot sizes). Related Domains are implemented by creating records in a specific table named 'Related_Domains' which is included in the feature service used by MobileMap when collecting data. See the Data Model section below for a description of the fields in the Rules table.
...
Validation Rule Examples
Rules use a very flexible format to support a wide range of validation tests. With this flexibility, however, comes complexity. To help understand the general format of MobileMap rules, consider the following examples that can be supported via Rules:
The field 'DBH' cannot have a value greater than '40'
The field 'Net Acres' cannot have a value greater than the field 'Gross Acres'
If the field 'Tree Type' has a value equal to 'Overstory', then the field 'DBH' cannot have a value less than '5'
If the field 'Component' has the value 'Live', then the field 'Snag Class' cannot have a value that is not equal to Null
If the fields 'DBH' and 'Height' both have a value not equal to 'Null', then the field 'Tally Measure' cannot have a value equal to 'T'
The field 'DBH' cannot have a value greater than '20'; If it does, warn the user but don't prevent saving the feature
...
Validation Rule Structure
At the hightes level, Rules are broken into 3 main parts - the criteria, comparison and the test. If the criteria is met, then the test is applied. In examples 1 and 2 above, there are no criteria and the tests are always applied. The comparison phrase in all of the examples above is 'cannot have a value'. If the test passes (is true), then the validation fails due to this comparison phrase.
...
Rule | Criteria Field | Criteria Operator | Criteria Value | Test Field | Test Operator | Test Value | Comparison | Error Type |
The field 'DBH' cannot have a value greater than '40' | NA | NA | NA | DBH | > | 40 | != | Error |
The field 'Net Acres' cannot have a value greater than the field 'Gross Acres' | NA | NA | NA | Net Acres | > | Gross_Acres | != | Error |
If the field 'Tree Type' has a value equal to 'Overstory', then the field 'DBH' cannot have a value less than '5' | Tree_Type | = | Overstory | DBH | < | 5 | != | Error |
If the field 'Component' has the value 'Live', then the field 'Snag Class' cannot have a value that is not equal to Null | Component | = | Live | Snag Class | != | Null | != | Error |
If the fields 'DBH' and 'Height' both have a value not equal to 'Null', then the field 'Tally Measure' cannot have a value equal to 'T' | DBH, Height | != | Null | Tally_Measure | = | T | != | Error |
The field 'DBH' cannot have a value greater than '20'; If it does warn the user but don't prevent saving the feature | NA | NA | NA | DBH | > | 20 | != | Warning |
Managing Validation Rules
In order to assist with the mangement of Validation Rules, InventoryManager provides a dedicated interface for creating and editing validation rules. The screenshot below shows this user interface in a typical InventoryManager implementation. Even if your organization is not using InventoryManager to manage your MobileMap data collection, screenshot below is still helpful to explain the process and inputs for creating and editing validation rules via ArcMap, ArcGIS Online, or ArcGIS Pro.
...
The full data model for the Rules table is shown in the image below. MB&G can provide a sample File Geodatabase with this data model upon request.
...
Related Domains
Testing Validation Rules
Validation rules currently only apply to MobileMap. They have not yet been implemented in InventoryManager. To test your validation rules, therefore, download them to MobileMap using the standard approach (Actions > Download). Make sure to review the download results and verify that new Rules records were downloaded. Next, collect (or edit) data using the layers for which the rules were created. For example, if a new business rule was created that is a warning for trees with DBH greater than 30”, open up a plot for editing, open up the tree list, and attempt to enter and save a tree with a DBH of 35. You should see a popup message with the error. In the case of a warning, you will still be able to save and close the tree list. All errors (and warnings) that are triggered by Validation Rules (rather than domain errors) will include the phrase ‘(business rule)’ to indicate that this error is not due to a coded value or range domain error, but rather a validation rule.
Related Domains
Overview
Related domains define the relationship between two fields that each use coded value domains to provide a list of allowed values for that field. Related domains restrict the choices in one attribute field based on the values selected in a related attribute field (e.g., if Plot Type is 'Variable Radius', Plot Size options should only include variable radius plot sizes and NOT fixed area plot sizes). To achieve this, a set of related domains records are added to the Related_Domains table. Each Related Domains record lists a value in the second field (target) dropdown list that should be available only if the specified value in the first field (source) dropdown list has been selected. To do this, related domains utilize a source field, source value, target field and target value. If the specified source value is selected for the source field, then the specified target value will be in the dropdown list for the target field.
Managing Related Domains
In order to assist with the mangement of Related Domains,
InventoryManager provides a dedicated interface for creating and editing
validation rules. The screenshot below shows this user interface in a
typical InventoryManager implementation. Even if your organization is
not using InventoryManager to manage your MobileMap data collection, the
screenshot below is still helpful to explain the process and inputs for
creating and editing Related Domains.
...
Note that while the InventoryManager Related Domains user interface includes a Layer, this is not actually stored in the Related_Domains table and is not required when enterying manually via ArcMap, ArcGIS Pro, or ArcGIS Online/Portal. This means that once a Related_Domain record has been created and downloaded to MobileMap, it will be applied to ALL layers where both the source and targe fields exist, even if that layer is not the same as the layer that was defined in InventoryManager when creating the Related Domains record.
Related Domains Data Model
The full data model for the Related_Domains table is shown in the image below. MB&G can provide a sample File Geodatabase with this data model upon request.
...
Disabling Validation Rules and Related Domains
MobileMap does not download data that have been deleted from the feature service. This means that if a Validation Rule and Related Domain record are no longer valid, they cannot be simply deleted from the service. In order for MobileMap devices to become aware that a Validation Rule and Related Domain record is not longer valid, it must be set to 'Archived' rather than actually deleted. When MobileMap downloads updated data by pressing the Download button (Actions > Download), it will update that rule to a status of Archived, and will no longer apply the rule when validating features or applying related domains to subset related field dropdown lists.