I was inspired by KGerrow's blog post to autogeneraet some attributes when creating a feature since it could save hundreds of hours of time. I'm looking for some feedback on my methods and code below. My aim is to autopopulate the field of one point feature layer from a field value of another point feature layer when I generate a new feature in a web map. What makes this different than what I have seen is that I have to buffer the point first to make sure the data is joined correctly.
I I think I'm missing some key piece of code to put the data from layer A into layer B. When I test
var A = FeatureSetByName($map, "A")
var B = FeatureSetByName($map, "B")
var C = Intersects(Buffer($feature, 20, 'feet'), FeatureSetByName($map, "A"))
for (var C in B)
{return C.ID}
How do I take the field from the buffered layer C and put it into layer B?
Solved! Go to Solution.
You won't be able to update attributes in another feature service using Arcade. From the help, Arcade is intended solely for evaluating embedded expressions such as those used in the visualization, labeling, popup, and alias contexts of applications built with the ArcGIS platform.
You will only be able to display the information you want when clicking on the feature. It will not be stored within the service's attributes.
Hi Shelby,
I think I'm following you correctly. You want to buffer layer B by 20 feet and get the ID from layer A. Is that correct?
Try the following:
var bufferLayer = Buffer($feature, 20, 'feet')
var intersectLayer =Intersects(FeatureSetByName($map,"A"), bufferLayer)
for (var f in intersectLayer){
return f.ID
}
Jake, yes exactly. But how does the code tell where to put the ID from buffered layer A into the right field in layer B?
In essence what I'm trying to do is this:if I create a new feature B that is within 20 feet of a feature in Layer A, take ID from Layer A and put it in ID for layer B.
You won't be able to update attributes in another feature service using Arcade. From the help, Arcade is intended solely for evaluating embedded expressions such as those used in the visualization, labeling, popup, and alias contexts of applications built with the ArcGIS platform.
You will only be able to display the information you want when clicking on the feature. It will not be stored within the service's attributes.
Thank you Jake, I appreciate your time and effort.