AnsweredAssumed Answered

Include Variable Name in ArcGIS Server Query Statement

Question asked by pmccord_wayne on Jul 26, 2019
Latest reply on Jul 26, 2019 by pmccord_wayne

I'm using the ArcGIS API for JS to query a Feature Layer hosted on ArcGIS Server. I'm trying to include a variable name in my "where" statement. For example:


var params = new Query({
  returnGeometry: true,
  outFields: ["*"]

params.where = "PropOwner = 'City' AND Location = commName";

In the above, I'm querying buildings where the Property Owner field is populated with "City" and commName is a variable defined when a user selects a location from a drop down list. However, my query doesn't work when I pass it the variable commName. 

I'm sure there is a simple way to do this. How do I need to revise my where statement to successfully pass it a variable name (in this case, commName)?