View Full Version : ERROR 4 (on a grid search with long filter expression)


02-18-2007, 12:13 PM
I'm using a DBF.Filter = expression with a very long expression of about 800 characters. It is long because I have a list of about 40 items in a variable.

I thought that the maximum characters in an expression was 1024. What is Error 4?

02-18-2007, 12:52 PM
You're right---1024 characters in an expression.

A search for this error brought up several but the most definitive was by Selwyn who said, "... error 4 is when there is an error in dbf filter expression." It can also can be an order expression error.


02-18-2007, 02:09 PM

As I said in this thread,


According to my testing notes, the maximum length of a Query filter is between 680 to 814 (680 always seems OK, 764 seems too large in some versions). I have not tested other values between these. I suspect the variation may also be due to the internal conversions A5 may make to process and they may exceed a length that is larger in there.

Maximum length of Query order (in other words the query key) is 254

There are ways to reduce a filter expression, by calling a UDF that computes a portion or the whole filter and returns true or false, although there is a speed penalty when doing this. Place LQO portions as part of the main filter, and the rest can be in the function.