query.outFields gives wrong result

490
1
07-13-2011 12:25 PM
DanielNieto_Jr
New Contributor
I need a query to give me an out field that is also part of the where query is this possible?

                smQueryTask= new esri.tasks.QueryTask("/arcgis/services/serverlocation");
                smQuery = new esri.tasks.Query();
                smQuery.returnGeometry = true;
                smQuery.outFields = ['Mile Value']; <-this is the value i want
                smQuery.where = locationsQuery; <- it also happens to be a field in the where(which works fine i.e. where ['Mile Value'..])
    
  console.log(smQuery); <-this is for debugging where i see the wrong values
                drawQueryThings();
........
// draw all locations
function drawQueryThings() {
    // execute query task
   console.log("Drawing QueryObjects");

    smQueryTask.execute(smQuery, function(drawAllQueryResults) {
            for (var i = 0 l = drawAllQueryResults.features.length; i < l; i++) {
   console.log(drawAllQueryResults.features); <-no features in there except for a completely unrelated attribute
...
}


Here are the values from firebug
1. outFields ["Mile Value"]
0"       Mile Value"
2. undefined.

hopefully this makes a little sense to somebody what I am trying to accomplish.
0 Kudos
1 Reply
StephenLead
Regular Contributor III

                smQuery.outFields = ['Mile Value']; <-this is the value i want



As far as I know, a field name cannot have a space. Verify the field name (not alias) in the dataset  at /arcgis/services/serverlocation

Steve
0 Kudos