Hi All,

I need some help with SETFILTER and the maximum length of the filter to be applied to a Code(20) field, in NAV 2009 Classic Client.

I have this form that prompts the user for some filters to be applied on a table. One of these filters is going to be set on the “Shortcut Dimension 3 Code” (which is a Code(20) field) using the following code:

RecAbc.SETRANGE(“Shortcut Dimension 3 Code”, txt_filter);

(txt_filter is a Text(250))

If the user types something like ‘LHCHPL|REOC6|CIHJM|REOC7|LHIRS|CHPLEMC’ I get the following error, even before the debugger starts:

"a value of the filter is too large for the field type: Type: Code 20"

But if I break the txt_filter in half, the code executes perfectly. If I run the table and set the filter manually I get no error and I get a set of data.

I am puzzled [:S]

I don’t want to reformulate the logic that I have already coded but if there is no other way…

Thanks once again!

I made a mistake, I meant

RecAbc.SETFILTER(“Shortcut Dimension 3 Code”, txt_filter); or RecAbc.SETFILTER(“Shortcut Dimension 3 Code”, ‘<>%1’, txt_filter)

Another strange thing, if I set the filter statically like


the code executes without any error…