I was hoping someone could help me figure out the issue I am having with configuring forms in New Webmap Viewer.
I tried to configure my form to automatically fill in a field from an intersecting layer using the code from this article on configuring forms for attribute editing.
The layer I am trying to intersect from is named 'Pole_feat' and I am trying to auto-populate my form to pull the value from the field 'wmextPole_TRMB_COMMENT'. This will save our field workers a tremendous amount of time as this value can get quite long.
When I test my code, it seems to work just fine and return the value I want (please see Image 1). However, when I test it out in field maps, it will only return my else statement of "nothing" (not all poles have this value filled out, so wanted an else statement).
I have tried the following:
-Verified both are in the same spatial reference
-Turned on snapping of my form's inspection feature
-Removed the else statement
-Verified the coordinates overlap (see Image 2)
-Tried turning on Pole_feat's popups
-Gave the wmextPoleT_TRMB_COMMENT an alias and tried using that
-Verified that the wmextPole_TRMB_COMMENT field has data (again please see Image 2)
-Tried using both a feature service and map image service of Pole_feat
I am at a total loss on what to do to get this field to autopopulate the intersecting pole. Any help would be greatly appreciated.
Here is my code:
if (IsEmpty(Geometry($feature))) {
return; // No geometry to process
} else {
// Find intersecting 'Pole_Intersect' features
var poleIntersects = Intersects($feature, FeatureSetByName($map, "Pole_feat"));
/ / Check if exactly one intersecting feature is found
if (Count(poleIntersects) == 1) {
// Return the value from 'wmextPole_TRMB_COMMENT' of the first intersecting feature
return Text(First(poleIntersects).wmextPole_TRMB_COMMENT);
} else {
return "nothing";
}
}
This is a screenshot of the example code from the ArcGIS Online Resources:
