Get records from a service

883
3
09-12-2016 12:04 PM
SamuelAbati
New Contributor III

We are trying to develop a custom form application to edit the attribute tables in our Feature Access service (it contains 1 feature class and 8 related tables with M-N relationships)

Using the example in esriRequest we were able to get both the "FeatureLayer" class and the 8 "Table" classes, my question is, how can I retrieve the records from these to display in a drop down list for example?

Code was used from this tutorial : Retrieve data from a web server | Guide | ArcGIS API for JavaScript 3.17  using Json

Then I changed the RequestSuceeded to get the data type 

function requestSucceeded(data) {
  alert(data.type) // prints "FeatureLayer" for feature class and "Table" for related tables
}

Another question, is there a better way to retrieve classes from services other than creating a new esriRequest for each class?

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Samuel,

   You can use the QueryTask and Query classes to retrieve the data from your services.

0 Kudos
SamuelAbati
New Contributor III

Thanks as always Robert

Do I perform the query on the service or on the classes returned by the response?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Samuel,

   On the service itself. An esriRequest does not return any classes it just returns json.

0 Kudos