Long Where in Query

2425
17
Jump to solution
09-01-2014 10:12 AM
hussambukhari
New Contributor


Dear All,

I need your help, I'm in situation that I need to use large where in query such as below, I need your help in doing that where i'm facing Syntax Error in IE 11 but in Chrome and Firefox its working fine.

I need your help in either using Where in query or other way to do the same result, I used Proxy as will but its not working.

the long Where as below:

query.where = "Trim(LICENSENUMBER) in ('MF1026','MF104','MF1051','MF1102','MF118','MF1190','MF120','MF1206','MF1267','MF1286','MF1288','MF1300',

'MF131','MF1311','MF1329','MF1425','MF1429','MF1481','MF151','MF1518','MF1575','MF1577','MF1587','MF1589',

'MF1605','MF1618','MF165','MF166','MF1680','MF1690','MF170','MF175','MF1767','MF1773','MF1781','MF1835','MF1854',

'MF186','MF1893','MF1898','MF1901','MF1922','MF1937','MF1941','MF1942','MF1954','MF1958','MF1961','MF1962','MF1964',

'MF1974','MF1976','MF1989','MF2','MF2003','MF2006','MF2007','MF2021','MF2044','MF2058','MF2059','MF2066','MF2079','MF2089',

'MF2095','MF2096','MF2099','MF21','MF2101','MF2102','MF2125','MF213','MF2132','MF2144','MF2218','MF2250','MF2270','MF2291',

'MF23','MF2304','MF2320','MF2326','MF2338','MF2351','MF2377','MF2378','MF2394','MF2411','MF2426','MF2452','MF2495','MF2503',

'MF2522','MF2527','MF254','MF2542','MF2553','MF2555','MF2599','MF2617','MF268','MF272','MF291','MF2934','MF2958','MF3065','MF3087',

'MF3100','MF3104','MF313','MF3167','MF3179','MF3223','MF3226','MF3273','MF3303','MF3331','MF3335','MF351','MF3516','MF3525','MF3534',

'MF3580','MF3586','MF3611','MF3636','MF368','MF3693','MF3696','MF3743','MF3886','MF391','MF394','MF41','MF429','MF439','MF440','MF456',

'MF464','MF466','MF467','MF469','MF472','MF473','MF571','MF613','MF624','MF663','MF687','MF74','MF765','MF772','MF87','MF949','MF999')";

The services is :

http://geoportal.abudhabi.ae/rest/services/HealthMapService/MapServer/1

0 Kudos
1 Solution

Accepted Solutions
AnthonyGiles
Frequent Contributor

The trouble your probably running into is the character limit that occurs in a URL within IE:

http - What is the maximum length of a URL in different browsers? - Stack Overflow

i'm not sure if a 9.31 server accepts requests as POST instead of GET or as SOAP instead of REST but it would be worth looking into that option.

all the other option could be to cut down your query into multiple queries than combine them back on the client

View solution in original post

0 Kudos
17 Replies
AnthonyGiles
Frequent Contributor

Hussam,

What is the result you are trying to achieve? I have queried everything in your layer an there are only 39 features In your hospital layer. Is it possible to use a LIKE statement?

If you are using the same list of license numbers each time you could create a view in your database that is based on that query, then select everything from that view.

Regards

Anthony

0 Kudos
hussambukhari
New Contributor

Thank you Anthony to reply, I had a REST services with more than 2000 clinic and center and I want to filter some of them best on the user query for the license.

can you please let me know if there is a better way to do that rather than the way I used above.

thank you again for your reply

0 Kudos
AnthonyGiles
Frequent Contributor

is the list of licence numbers always going to be the same? If so you could create a view in your database or a definition query in arcmap so that you have another layer that is already filtered

0 Kudos
hussambukhari
New Contributor

unfortunately there arc server is hosted with in different entity where just I can consume their REST services.

and the health facility might be change every time...

0 Kudos
AnthonyGiles
Frequent Contributor

The trouble your probably running into is the character limit that occurs in a URL within IE:

http - What is the maximum length of a URL in different browsers? - Stack Overflow

i'm not sure if a 9.31 server accepts requests as POST instead of GET or as SOAP instead of REST but it would be worth looking into that option.

all the other option could be to cut down your query into multiple queries than combine them back on the client

0 Kudos
hussambukhari
New Contributor

Thank you Anthony, I will do what you suggest.

0 Kudos
hussambukhari
New Contributor

just last issue, why the services is working fine when I use the rest services directly and but the same query in the query layer where it will run with out error in the IE

http://geoportal.abudhabi.ae/rest/services/HealthMapService/MapServer/4/query

0 Kudos
hussambukhari
New Contributor

this simple request

0 Kudos
AnthonyGiles
Frequent Contributor

Sorry Hussam I don't understand your last question, could you re-phrase

0 Kudos