Is there a length limit when using setDefinitionExpression?

781
3
Jump to solution
05-09-2019 09:37 AM
AndrewBowne
Occasional Contributor III

I have a javascript application that sets a definition expression to a map service layer based on user-defined criteria.  There are instances where this expression can be very lengthy (for instance, one problematic expression is 24,000 characters).  

Is there a limit to how long a definition expression can be?  

Do (will) definition expressions use a proxy service?

Thanks,

Andrew

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Andrew,

   Wow a 24,000 character definition expression... Are you using a ton of AND or ORs in the SQL? If so you should try using IN instead. The limitation is not a hard set limitation and varies on the underlying Database used. A Google search will reveal several results and nothin with a specific limit, just general advice to reconsider your workflow if your query is that large, (like consider an inverse of the SQL statement).

View solution in original post

3 Replies
RobertScheitlin__GISP
MVP Emeritus

Andrew,

   Wow a 24,000 character definition expression... Are you using a ton of AND or ORs in the SQL? If so you should try using IN instead. The limitation is not a hard set limitation and varies on the underlying Database used. A Google search will reveal several results and nothin with a specific limit, just general advice to reconsider your workflow if your query is that large, (like consider an inverse of the SQL statement).

AndrewBowne
Occasional Contributor III

Yes, it's a ton of "OR"'s.  I considered doing an inverse query but I think that might be just as bad.  (these are statewide sampling locations so there are A LOT of them.  I will try using an "IN" statement and see if that works.  

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

It is far more efficient than a ton of Ors.

0 Kudos