Select to view content in your preferred language

Road Closure relationships

665
4
Jump to solution
01-30-2024 09:15 AM
Joshua-Young
Frequent Contributor

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?

"Not all those who wander are lost" ~ Tolkien
0 Kudos
1 Solution

Accepted Solutions
ChrisFox
Esri Regular Contributor

@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.

View solution in original post

0 Kudos
4 Replies
ChrisFox
Esri Regular Contributor

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:

ChrisFox_0-1706637434653.png

 

0 Kudos
Joshua-Young
Frequent Contributor

@ChrisFoxI am not seeing a Blocks or Detours section in the editing form in Experience Builder or Map Viewer.

JoshuaYoung_0-1706638783635.png

They do show up on the Configure Form page in the web map

JoshuaYoung_1-1706638871058.png

 

"Not all those who wander are lost" ~ Tolkien
0 Kudos
ChrisFox
Esri Regular Contributor

@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.

0 Kudos
Joshua-Young
Frequent Contributor

In case anyone is interested, here is an Arcade expression I created to work around the 11.2 limitation. You will need to:

  1. add the closureglobalid field to the Blocks and Detours forms
  2. set the field visibility to hidden
  3. make sure editing is disabled
  4. set the field to not required
  5. create a new Arcade expression using the code below and assign it to the closureglobalid field
// 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'];
}

 

"Not all those who wander are lost" ~ Tolkien
0 Kudos