Passing multiple values to setDefinitionExpression

2398
2
Jump to solution
08-14-2013 03:05 PM
KennethRichards
New Contributor III
Is there a way to pass multiple values to the setDefinitionExpression method?

I tried this and it only reads the first value passed to it.

wellFeatureLayer.setDefinitionExpression("welltype='Gas'","welltype='Geothermal'","welltype='Water'" );


Could I pass some sort of array to it? Snippets of code would be greatly appreciated.
0 Kudos
1 Solution

Accepted Solutions
JasonZou
Occasional Contributor III
If the definition expression is for one field, use IN operator then.
wellFeatureLayer.setDefinitionExpression("welltype IN ('Gas','Geothermal','Water')");

Refer to http://resources.arcgis.com/en/help/main/10.1/index.html#//00s500000033000000 for more details.

View solution in original post

0 Kudos
2 Replies
JohnGravois
Frequent Contributor
ah, the wonders of complex SQL expressions..

"FIELD_NAME = 'value 1' OR FIELD_NAME = 'value 2'"
0 Kudos
JasonZou
Occasional Contributor III
If the definition expression is for one field, use IN operator then.
wellFeatureLayer.setDefinitionExpression("welltype IN ('Gas','Geothermal','Water')");

Refer to http://resources.arcgis.com/en/help/main/10.1/index.html#//00s500000033000000 for more details.
0 Kudos