Hi there. Now we all know the two functions GETRANGEMAX and GETRANGEMIN, do we. If you set a single range on a field and then call one of these functions they give you the min/max value in your range. If it is a range. If not it breaks out with an error. Now i wanted to know if i can prevent those runtime errors. I mean: if it is a range, return me the min/max value, if not so, dont do anything. I did not find anything useful 'til now. Thanks for any ideas

IF GETFILTER(field) <> ‘’ then getrangemax …

so you can try that: SETFILTER(“field”, ‘Value1|Value2’); GETFILTER will return something. GETRANGEMAX will bring about an error.

I can’t think of anyway to circumvent this situation. Short of asking Navision to include a return value in these functions ([OK] := GETRANGEMAX(Field)), there is not much you can do. Maybe you could use the string obtained with GETFILTER, parse it to check for special filter characters like | … & and do something if it is a simple range filter.

i was thinking of workaround that way: Date.SETFILTER("Period Start", DateFilter); IF Date.FIND('-') then Date1 := Date."Period Start"; IF Date.FIND('+') then Date2 := Date."Period Start"; should do the job for me.

As an example, try this OBJECT Table 50000 Test FIELDS { { 1 ; ;ID ;Code10 } { 2 ; ;Data ;Text250 } } OBJECT Codeunit 50000 Test PROPERTIES { TableNo=50000; OnRun=VAR varTest@1000000000 : Record 50000; BEGIN IF Data = '''''' THEN varTest.SETFILTER(varTest.Data, '%1', Data) ELSE varTest.SETFILTER(varTest.Data, Data); CASE ID OF 'MAX': Data := varTest.GETRANGEMAX(Data); 'MIN': Data := varTest.GETRANGEMIN(Data); END; END; } And finally you can try the following test code VAR recTest@1000000000 : Record 50000; cduTest@1000000001 : Codeunit 50000; BEGIN recTest.ID := 'MAX'; recTest.Data := GETFILTER(<YourField>); IF cduTest.RUN(recTest) THEN MESSAGE('RANGE%1: %2', recTest.ID, recTest.Data) ELSE MESSAGE('No filter\\or\\No valid range'); END;