Get a server-defined trace configuration for a given tier and modify its traversability scope, add new condition barriers, and control what is included in the subnetwork trace result.

Use case
While some traces are built from an ad-hoc group of parameters, many are based on a variation of the trace configuration taken from the subnetwork definition. For example, an electrical trace will be based on the trace configuration of the subnetwork, but may add additional clauses to constrain the trace along a single phase. Similarly, a trace in a gas or electric design application may include features with a status of “In Design” that are normally excluded from trace results.
How to use the sample
The sample loads with a server-defined trace configuration from a tier. Use the switches to toggle which options to include in the trace - such as containers or barriers. Tap the middle button on the bottom toolbar to create a new condition to add to the list. Swipe left on a condition under “List of conditions” to delete it or tap “Reset” to delete the whole list. Tap “Trace” to run a subnetwork trace with this modified configuration from a default starting location.
Example barrier conditions for the default dataset:
- ‘Transformer Load’ equal ‘15’
- ‘Phases Current’ doesNotIncludeTheValues ‘A’
- ‘Generation KW’ lessThan ‘50’
How it works
- Create and load a
UtilityNetworkwith aServiceGeodatabasefrom a feature service URL, then get an asset type and a tier by their names. - Populate the choice list for the comparison source with the non-system defined
UtilityNetworkDefinition.networkAttributes. Populate the choice list for the comparison operator with the enum values fromUtilityAttributeComparisonOperator. - Create a
UtilityElementfrom this asset type to use as the starting location for the trace. - Update the selected barrier expression and the checked options in the UI using this tier’s
TraceConfiguration. - When an attribute has been selected, if its
Domainis aCodedValueDomain, populate the choice list for the comparison value with itsCodedValues. Otherwise, display aTextFieldfor entering an attribute value. - When “Add” is tapped, create a new
UtilityNetworkAttributeComparisonusing the selected comparison source, operator, and selected or typed value. Use the selected source’sdataTypeto convert the comparison value to the correct data type. - If the traversability’s list of
barriersis not empty, create anUtilityTraceOrConditionwith the existingbarriersand the new comparison from step 6. - When “Trace” is tapped, create
UtilityTraceParameterspassing insubnetworkand the default starting location. Set itstraceConfigurationwith the modified options, selections, and expression; then trace the utility network withUtilityNetwork.trace(using:). - When “Reset” is tapped, set the trace configurations expression back to its original value.
- Display the count of returned
UtilityElementTraceResult.elements.
Relevant API
- CodedValueDomain
- UtilityAssetType
- UtilityCategory
- UtilityCategoryComparison
- UtilityCategoryComparisonOperator
- UtilityDomainNetwork
- UtilityElement
- UtilityElementTraceResult
- UtilityNetwork
- UtilityNetworkAttribute
- UtilityNetworkAttributeComparison
- UtilityNetworkAttributeComparison.Operator
- UtilityNetworkDefinition
- UtilityTerminal
- UtilityTier
- UtilityTraceAndCondition
- UtilityTraceConfiguration
- UtilityTraceOrCondition
- UtilityTraceParameters
- UtilityTraceResult
- UtilityTraceType
- UtilityTraversability
About the data
The Naperville electrical network feature service, hosted on ArcGIS Online, contains a utility network used to run the subnetwork-based trace shown in this sample.
Additional information
Using utility network on ArcGIS Enterprise 10.8 requires an ArcGIS Enterprise member account licensed with the Utility Network user type extension. Please refer to the utility network services documentation.
Tags
category comparison, condition barriers, network analysis, network attribute comparison, subnetwork trace, trace configuration, traversability, utility network, validate consistency