Multiple OR's in where clause of map service query

1314
1
02-07-2018 04:09 PM
AdamMichaleski
New Contributor II

Is it possible to do 'OR' in the WHERE clause off the Query method of a map service. We are running into errors when providing SQL like this :

WHERE
(
OBJECTID IS NOT NULL
AND OBJECTID LIKE '%fdas%'
)
OR (
ID IS NOT NULL
AND ID LIKE '%fdas%'
)
OR (
Label IS NOT NULL
AND Label LIKE '%fdas%'
)

This seems to be legal SQL, and the documentation says any legal SQL would work, so I'm a bit confused as to why this isn't working. It works if we do one field at a time, but it's leading to a massive amount of HTTP calls.

Tags (1)
0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

Adam,

   The fact that you have OBJECTID LIKE '%fdas%' seems off. OBJECTID  is normally a numberic field and you are attempting to do a like query for a string.

 I can get a where like this to run, without issue:

query.where = "(STATE_NAME IS NOT NULL AND STATE_NAME LIKE '%fdas%') OR (STATE_ABBR IS NOT NULL AND STATE_ABBR LIKE '%fdas%')"