Setting built filter with no luck...

Our customer wants users to be able to see Warehouse documents from all locations in which the user has been assigned in the Warehouse User table (i.e. not only thier default location).

So I have created a function which filters the Warehouse User table for the userid, then builds and returns a filter from the resulting set of entries. I then set the filter before the Warehouse Shipment form is opened.

However, the system does not see this as a filter and complains of it being to big. The rather odd error follows (I say odd as I dont know why it repeats itself).


Microsoft Dynamics NAV

A value in the filter ‘(AKL|CHC|ET|LS|MFC|TWH)&(‘AKL|CHC|ET|LS|MFC|TWH’)’ in the Location Code field in the Warehouse Shipment Header table is too long for the field type.

Type: Code10

OpenWhseShptHeader

IF USERID <> ‘’ THEN BEGIN
WhseEmployee.SETRANGE(“User ID”,USERID);
IF NOT WhseEmployee.FIND(’-’) THEN
ERROR(Text002,USERID);

WhseEmployee.SETRANGE(“Location Code”,WhseShptHeader.“Location Code”);
IF WhseEmployee.FIND(’-’) THEN
CurrentLocationCode := WhseUtilFunctions.CreateWhseEmpFilter;
// CurrentLocationCode := WhseShptHeader.“Location Code”
// ELSE
// CurrentLocationCode := WmsManagement.GetDefaultLocation;

WhseShptHeader.FILTERGROUP := 2;
// WhseShptHeader.SETRANGE(“Location Code”,CurrentLocationCode);
WhseShptHeader.SETFILTER(“Location Code”,’%1’,CurrentLocationCode);
WhseShptHeader.FILTERGROUP := 0;
END;

I’ve tried SETRANGE and SETFILTER with no luck. I’ve confirmed in the debugger that the filter is being built correctly.

No doubt I’m doing something stupid…

Your filter is built incorectly - there shouldn’t be apostrophes inside the filter, because ‘AKL|CHC|ET|LS|MFC|TWH’ is interpreted as single value, which is too long.