Why is Filtergroup (-1) in Navision Page OR filtering on page level not working

826 Views Asked by At

Is it possible that filtering with an OR condition (using FILTERGROUP(-1)) isn't working on page level`? and if so, why isn't it working?

I'am new to MS-Navision and i try to understand the underlining programming of it. in MS-Navision Cronus-AG DB i created a Page based on the Customer Table. In the Customer Table i added two fields ( Datefield Date and CodeField Integer). The created Page should only display Customers where Datefield OR codefield is empty. I used two empty Variables called

date Date 
codefield Code

I Tried to use the following Code in the OnOpenPage-Trigger:

 CLEAR(date);
 CLEAR(c20);
 
 FILTERGROUP(-1);
 SETFILTER(DateField, '%1', date);
 SETFILTER(CodeField20Old, '%1', c20);
 FILTERGROUP(0); // tried to remove this line, still not working

But no filter is set, especially not in the OR-Filter condition. How ever, if i use the same code snipped in a Codeunit, it is working the right way. And if i change FILTERGROUP(-1) to FILTERGROUP(2) a filter is set (with an AND-Condition).

Can anybode explain me this bevhavior?

1

There are 1 best solutions below

0
On

While this may not be a direct anwser to your question, for your filtered record to show up in your page, you need to mark every single line and then only show the marked lines:

FILTERGROUP(-1);
SETFILTER(DateField, '%1', date);
SETFILTER(CodeField20Old, '%1', c20);

IF FindSet() then
  repeat
    Mark(true);
  until Next() = 0;

FILTERGROUP(0);
MarkedOnly(true);