How to Query a flat table in JavaScript API

2844
3
Jump to solution
08-22-2016 05:11 AM
ShaikhRizuan
New Contributor III

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
Occasional Contributor III

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
New Contributor III

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

Anyways thanks Basson..

0 Kudos
Drew
by
Occasional Contributor III

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