Automatically filtering records when user opens a form

david.weeksdavid.weeks Member Posts: 96
edited 2004-05-19 in Navision Attain
Hello All,

I have used the table filter within SourceTableView to automatically apply a filter on the open field when the user opens the customer ledger entry table.

However, when they press SHOWALL button, I want all entries to be displayed including entries that are not open. But at the moment, pressing SHOW ALL just lists all open entries for all customers.

Ideas?

Thanks

Comments

  • david.weeksdavid.weeks Member Posts: 96
    Hi,

    I have solved this problem by not using the sourcetableview.
    I have used SETFILTER within the OnInit of the form.

    However, and this is already part of Navision, when you press SHOWALL, it shows all records for all customers (i.e. as per usual).

    Any way of keeping the customer filter when pressing Show All?

    Thanks
  • WaldoWaldo Member Posts: 3,412
    Try this:

    Put the code below in a codeunit, and call it like cdu.fctSetFilter(Rec);
    fctSetFilter(VAR prec: Record "Record Of Form")
    
    WITH prec DO BEGIN
          FILTERGROUP(2);
          SETCURRENTKEY(field1,field2);
          SETRANGE(field1,'test1');
          SETRANGE(field2,'test2);
          FILTERGROUP(0);
    END;
    

    Tip: Read the C/SIDE help on FILTERGROUP, it explains a lot!

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • RobertMoRobertMo Member Posts: 484
    and it is not needed to have this code in cu, you can have your function on table/form or even without function. depends on where else you would like to apply your filtering. important part is between BEGIN and END
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Sign In or Register to comment.