Select to view content in your preferred language

How to Query a flat table in JavaScript API

3127
3
Jump to solution
08-22-2016 05:11 AM
ShaikhRizuan
Regular Contributor

Hi,

I want to query a flat table present in SQLdatabase from JavaScript API. I have published the map service including the flat table and got the REST URL. When i query the table, i am not able to see any field attributes or values. Below is the code:

var queries = [];
var queryTask = new QueryTask("https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServe...");
var query = new Query();
query.where = "OBJECTID = 4";
query.outFields = ["TABLENAME", "FIELDNAME", "VALUEINFO"];
query.returnGeometry = true;
queries.push(queryTask.execute(query));
var iPromises = new all(queries);
iPromises.then(lang.hitch(this, function (r) {
      r.length // coming length as One but not able to see field values
}
}));

Also find screen-shot for the same:

Screenshot

Any idea.. how to get the field values.???

Regards,

Shaikh Rizuan

0 Kudos
1 Solution

Accepted Solutions
Drew
by
Frequent Contributor

I would just query WHERE  1=1  I don't see an Object ID of 4 in the data and set the OutFields to be ["*"].
That should give you some results to play with.

REST QUERY

Drew

View solution in original post

3 Replies
FC_Basson
MVP Regular Contributor

Have you tried the query using the fields aliases i.e. "Field Name", "Table Name" etc?  

ShaikhRizuan
Regular Contributor

Its working, When i tried with different field names.. other than ObjectID

Anyways thanks Basson..

0 Kudos
Drew
by
Frequent Contributor

I would just query WHERE  1=1  I don't see an Object ID of 4 in the data and set the OutFields to be ["*"].
That should give you some results to play with.

REST QUERY

Drew