Select to view content in your preferred language

appending variables in a query

646
2
07-29-2010 10:51 AM
DebbieJamieson
Emerging Contributor
I can create a query with mulitple variables just fine if I hardcode all of them...

  <esri:Query id="query"  where="STATE_NAME = 'Texas' and pop1990 &lt; 1000000" text="{qCityName.text}" returnGeometry="true" outSpatialReference="{map.spatialReference}">

BUT, I want to use the users input of State value and can't figure out how to append it, I have tried..

       <esri:Query id="query"  where="STATE_NAME = '" + "{qStateName.text}" + "' and pop1990 &lt; 1000000"  returnGeometry="true" outSpatialReference="{map.spatialReference}">

      <esri:Query id="query"  where="STATE_NAME = '"  & "{qStateName.text}" & "' and pop1990 &lt; 1000000"  returnGeometry="true" outSpatialReference="{map.spatialReference}">

but get syntax errors. Any ideas???
thanks
Tags (2)
0 Kudos
2 Replies
ReneRubalcava
Esri Frequent Contributor
If you're using the where clause, I don't think you need the text property. It's not your error though.

<esri:Query id="query" where="STATE_NAME = '{qStateName.text}' and pop1990 &lt; 1000000" returnGeometry="true" outSpatialReference="{map.spatialReference}">


FlashBuilder makes it look like you're passing regular text, but you're really binding it to the input.
0 Kudos
EokNgo
by
Deactivated User
I can create a query with mulitple variables just fine if I hardcode all of them...

  <esri:Query id="query"  where="STATE_NAME = 'Texas' and pop1990 &lt; 1000000" text="{qCityName.text}" returnGeometry="true" outSpatialReference="{map.spatialReference}">

BUT, I want to use the users input of State value and can't figure out how to append it, I have tried..

       <esri:Query id="query"  where="STATE_NAME = '" + "{qStateName.text}" + "' and pop1990 &lt; 1000000"  returnGeometry="true" outSpatialReference="{map.spatialReference}">

      <esri:Query id="query"  where="STATE_NAME = '"  & "{qStateName.text}" & "' and pop1990 &lt; 1000000"  returnGeometry="true" outSpatialReference="{map.spatialReference}">

but get syntax errors. Any ideas???
thanks


I believe the issue is in your where clause. The whole where statement should be a single text string:
where="'STATE_NAME = ' + {qStateName.text} + ' and pop1990 &lt; 1000000'"

Try that.
0 Kudos