Automatically populate field with values from another layer

4395
5
03-02-2016 02:11 AM
EduardoD__Cuesta
New Contributor

Hi all,

I would like how I could do to autopopulate some fields in a Feature Server according to spatial values from another layers. For instance, if I add a point and has a Distict field, I want to fill that field automatically with the name of the district where the point is, from a district layer.

Tha aim of this is to be used in an application.

Thanks in advance.

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus

Eduardo,

What you are wanting to do is possible but pretty complicated.

Here is my recommended workflow steps that you would have to do:

1. Use the edit toolbar inorder to add your new feature.

Edit without editor widget | ArcGIS API for JavaScript

2. In the draw-end function before the selectedTemplate.featureLayer.applyEdits you would need to query the districts layer to see if the point you placed intersects.

3. For that you would use a QueryTask and a Query class that would use the geometry from step two and the SPATIAL_REL_INTERSECTS

4. Once you have results from that query you can get the results[0].attributes.District and put that in a var.

5. Then update the newAttributes array to replace the existing District value with the new on retrieved.

6. Then you can finally the selectedTemplate.featureLayer.applyEdits.

If you can not comprehend this workflow then this is probably something you will need to hire a developer/consultant company for as I mentioned this is possible but is not something that is easy.

JacobTodd1
New Contributor III

Hi Eduardo,

Where is this data hosted? Is it hosted on ArcGIS Online or on your own local ArcGIS for Server server?

Thanks

0 Kudos
EduardoD__Cuesta
New Contributor

Hi Jacob,

The data are in a sde Oracle database, it is Feature Server in ArcGIS server.

Thanks in advance.

0 Kudos
JacobTodd1
New Contributor III

Hi Eduardo,

Thanks for your response. Since you are utilizing an SDE Oracle geodatabase as well as ArcGIS for Server, I would suggest that you do some research into database triggers. I have included a few resources regarding this topic below. Please keep in mind that configuring these triggers will not be supported by Esri Technical  Support. I hope these resources will at least get you on the right track!

34972 - Use an Oracle trigger on a table to update an st_geometry attribute

Feature classes in a geodatabase in Oracle—Help | ArcGIS for Desktop

EduardoD__Cuesta
New Contributor

Thank you so much, I will have a look.

0 Kudos