...
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
...
The table below breaks down each of the six examples above into their component criteria, comparisons and the tests:
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
...
If using InventoryManager:
Select the layer that the rule should act upon
Click on the desried layer in the dropdown list.
Define the criteria that must be met prior to applying the test. In the example above, the test should only be applied if the field 'Contract_or_State' has a value equal to 'Contract'. If the field 'Contract_or_State' is null or has a value that is not equal to 'Contract', the test portion of the rule will not even be assessed.
If a criteria is needed:
Enter the criteria value
Enter the text or number in the input. If the criteria value is null, enter as 'Null' (without quotes). If the value is coming from a field, enter in the field within curly brackets { } (e.g., '{Contract_or_State}' without the quotes
Select the criteria operator
Click on the desried operator in the dropdown list.
Select the criteria field.
Click on the field name in the selection box. If more than one field is needed, click on the first field name, then hold CTRL and click on additional field names
If no criteria is needed because the test should always be applied (see examples 1, 2 and 6 above):
Uncheck the 'Include criteria' checkbox
Select the test inputs
Select the test field.
Click on the field name in the selection box. If more than one field is needed, click on the first field name, then hold CTRL and click on additional field names
Select the test operator
Click on the desried operator in the dropdown list.
Select the error type
Select 'Error' or 'Warning' from the dropdown list
Enter the error (or warning) message to display to the user
Enter the full message that should be displayed to the user if the features does not pass the validation rule
If using table capabilities of ArcMap, ArcGIS Pro, or ArcGIS Online. Example rule: If the field 'Tree Type' has a value equal to 'Overstory', then the field 'DBH' cannot have a value less than '5'
Generate a table named Rules using either ArcMap, ArcGIS Pro, ArcGIS Online. See the image below for the full data model of the Rules table.
WSG can provide a sample File Geodatabase with this data model upon request. Each row in the table defines one rule. "LEFT" inputs, aggregators, and operators correspond to the criteria portion of the rule. "RIGHT" inputs, aggregators, and operators correspond to the test portion of the rule. The "MAIN_OPERATOR" corresponds to the comparison portion of the rule.
Define the criteria that must be met prior to applying the test by attributing the "LEFT" attributes of the Rules table. In the example above, the test should only be applied if the field 'Tree Type' has a value equal to 'Overstory'. If the field 'Tree Type' is null or has a value that is not equal to 'Overstory', the test portion of the rule will not be assessed.
If a criteria is needed:
LEFT_INPUT1 - Enter field name within curly brackets { } (e.g., '{Tree_Type}' without the quotes. If more than one field is needed, separate the field names using comas (e.g., '{DBH},{Height}' without the quotes).
LEFT_AGGREGATOR1 - Enter 'Value' in this field if one field is used as the LEFT_INPUT1 field. Other options include 'Sum' to sum the values in multiple fields listed in the LEFT_INPUT1 field.
LEFT_OPERATOR - Enter the appropriate operator (=, !=, >,>=, <,<=)
LEFT_INPUT2 - Enter the text or number in the input. If the criteria value is null, enter as 'Null' (without quotes). If the value is coming from a field, enter in the field within curly brackets { } (e.g., '{Overstory}' without the quotes
LEFT_AGGREGATOR2 - Enter 'Value' if one field or a number or a text is used as the LEFT_INPUT2 field.
If no criteria is needed because the test should always be applied (see examples 1, 2 and 6 above):
LEFT_INPUT1 - Enter '1'
LEFT_AGGREGATOR1 - Enter 'Value'
LEFT_OPERATOR - Select '='
LEFT_INPUT2 - Enter '1'
LEFT_AGGREGATOR2 - Enter 'Value'
Select the test inputs
RIGHT_INPUT1 - Enter the field name within curly brackets { } (e.g., '{DBH}' without the quotes). If more than one field is needed, separate the field names using comas (e.g., '{DBH},{Height}' without the quotes).
RIGHT_AGGREGATOR1 - Enter 'Value' from the dropdown list for the field or 'Sum' if multiple fields are listed.
RIGHT_OPERATOR - Enter the appropriate operator (=, !=, >,>=, <,<=)
RIGHT_INPUT2 - Enter the text or number in the input. If the criteria value is null, enter as 'Null' (without quotes). If the value is coming from a field, enter in the field within curly brackets { } (e.g., '{DBH}' without the quotes
RIGHT_AGGREGATOR2 - Enter 'Value' from the dropdown list for the field or 'Sum' if multiple fields are listed.
Select the Comparison
MAIN_OPERATOR - Enter '!='
Select the error type
ERROR_TYPE - Enter 'Error' or 'Warning' from the dropdown list
Enter the error (or warning) message to display to the user
ERROR_MESSAGE - Enter the full message that should be displayed to the user if the features does not pass the validation rule
Example rule: If the field 'Tree Type' has a value equal to 'Overstory', then the field 'DBH' cannot have a value less than '5'
Criteria
LEFT_INPUT1 | LEFT_AGGREGATOR1 | LEFT_OPERATOR | LEFT_INPUT2 | LEFT_AGGREGATOR2 |
---|---|---|---|---|
{Tree_Type} | Value | = | {Overstory} | Value |
Test
RIGHT_INPUT1 | RIGHT_AGGREGATOR1 | RIGHT_OPERATOR | RIGHT_INPUT2 | RIGHT_AGGREGATOR2 |
---|---|---|---|---|
{DBH} | Value | < | 5 | Value |
Comparision and Error Type
MAIN_OPERATOR | ERROR_TYPE | ERROR_MESSAGE |
---|---|---|
!= | Error | Overstory trees cannot have a DBH less than 5 |
Complete Rules Data Model
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.
...
If using InventoryManager
Select the layer that the rule should act upon (this will populate the list of available fields for the source and targe fields)
Select the source field (this is the field that should then restrict the values of the target field dropdown list)
Select the source value (this is the value of the source field that will restrict the values of the target field)
Select the target field (this is the field that should be restricted based on the selected source field and value)
Select the target value (this is a value that should be available to users in the dropdown list for the target field when the selected soure value is chosen for the selected source field).
Click Add to create the new feature
When editing a record, click the 'Edit' button to the right of that record in the list of related domains, then update the values as described above and finally click 'Update' and review the updated record in the list of related domains.
If using table capabilities of ArcMap, ArcGIS Pro, or ArcGIS Online/Portal:
Enter the source field name (this is the field that should then restrict the values of the target field dropdown list)
Enter the code (NOT description) for the source value (this is the value of the source field that will restrict the values of the target field)
Enter the target field (this is the field that should be restricted based on the selected source field and value)
Enter the code (NOT description) for the target value (this is the value that should be available to users in the dropdown list for the target field when the selected soure value is chosen for the selected source field).
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.
...
The full data model for the Related_Domains table is shown in the image below. MB&G WSG can provide a sample File Geodatabase with this data model upon request.
...