My organization is looking at deploying the Road Closure solution version 2.0. During the creation of a road closure, blocks, and detour I noticed that the closure popup had placeholders for related blocks and detours. I did not see a way to relate those features during the creation of the features and I had to open up the service properties page to see that relationship was built off of the closure GlobalID.
Is there an easy way to associate closures, blocks, and detours during the creation of the features? Would there be an issue with creating an Arcade expression to find the most recently added intersecting closure to copy the GlobalID to the blocks and detours?
Solved! Go to Solution.
@Joshua-Young, I just realized you are at Enterprise 11.2. Editing related records via the form is not available in Enterprise 11.2. It will be coming at 11.3. For now having related blocks and detours is not critical to the solution and is not important to the community maps program for closures.
In the Road Closures app if you select an existing road closure line to edit the feature you can scroll down to the bottom of the form to view and add related road blocks and detours:
@ChrisFoxI am not seeing a Blocks or Detours section in the editing form in Experience Builder or Map Viewer.
They do show up on the Configure Form page in the web map
@Joshua-Young, I just realized you are at Enterprise 11.2. Editing related records via the form is not available in Enterprise 11.2. It will be coming at 11.3. For now having related blocks and detours is not critical to the solution and is not important to the community maps program for closures.
In case anyone is interested, here is an Arcade expression I created to work around the 11.2 limitation. You will need to:
// This expression is intended to be used with
// Road Closures version 2.0 for ArcGIS Enterprise 11.2
// Set the field names from the Closures layer
var closureidField = 'closureid';
var globalidField = 'globalid';
var createddateField = 'created_date';
// Set the buffer distance and units
var bufferDistance = 10;
var bufferUnits = 'meters'
// Get the closure features
var closures = FeatureSetById($datastore, 1, [closureidField, globalidField, createddateField], true);
// Get an array of all closures within the specified buffer distance
var intersectingClosures = Intersects(closures, Buffer($feature, bufferDistance, bufferUnits));
// Check to see if any closures were intersected
if (intersectingClosures != null){
var lastCreatedDate;
var lastClosure;
// Loop through all the intersected closures and return
// the GlobalID of the most recently added closure
for (var closure in intersectingClosures){
// Get the created date from the first intersected closure
if(lastCreatedDate == null){
lastCreatedDate = closure[createddateField];
lastClosure = closure;
}
// Compare the last closure the the next one in the loop
// and keep the most recent one
else{
if (lastCreatedDate < closure[createddateField]) {
lastCreatedDate = closure[createddateField];
lastClosure = closure;
}
}
}
// Return the GlobalID for the most recent
// intersecting closure
return lastClosure['globalid'];
}