AnsweredAssumed Answered

Query.where syntax question - onClick of dGrid

Question asked by schlot on Jul 12, 2013
Latest reply on Jul 12, 2013 by schlot
I have a SQL database view connected to my block group layer through the ID number.  In my service, this view is loaded as a Query Table.  This resulted in rather long field names for all the columns coming from the join. 

In my code, the user is allowed to draw a box as the input geometry, which runs a query task against the block groups and populates the results in a dGrid. The dGrid includes a row renderer.  The information populated is the census block ID, which is unique, and some other demographic information. My grid looks fine. 

Next I need to allow the user to select a grid row and highlight that one feature on the map.  I have code that runs another queryTask, using a where clause this time to search on the census ID from the grid row.  Here's where my problem comes in.  I think my where clause has the right syntax, but it says there are no features found.  I can see that queryId has a value before I build the where clause, so I know it isn't blank.  I can use the rest end point with my big long field name and query the record by that ID.  Is there a problem with my very long field name in my where clause?  Do I need additional punctuation because of all the underscores and periods in it?

selectGrid.on('.dgrid-row:click',function(event){         var row = selectGrid.row(event);         var queryTask = new esri.tasks.QueryTask(eezLayer.url+"/1");         var query = new esri.tasks.Query();                                                 var queryId = [];        query.where ="DE_MOEEZ.DEAPPMOEEZGISD.blockGroupCalculations.BlockGroupName = '" + queryId+ "'";        query.returnGeometry = true;     var deferred = queryTask.execute(query);       deferred.addCallback(function (response){      if (response.length > 0) {       var feature = response[0];       var graphic = new esri.Graphic(feature.geometry, highlightFillSymbol);      graphic.setSymbol(redFillSymbol);;      map.centerAndZoom(feature.geometry,14);     }else {       console.log('no feature matching the where clause');    }             });  deferred.addErrback(function (error) {         console.log("Grid Select Error = " + error);     });   }); }