Options

Filter table with copyfilter

fernandojsdiasfernandojsdias Member Posts: 5
edited 2020-03-03 in NAV Three Tier
Hi,
I have on problem, I need to filter the item table from the result of filtering other table.
The code is this, I am trying to avoid the "ItemFilter" variable.

IF (Rec."NO ProdGruppe" <> '') AND (Rec."Item No." = '' ) THEN BEGIN
Group.RESET;
Group.SETRANGE(Group,Rec."NO ProdGruppe");
IF Group.FINDFIRST THEN BEGIN
Paragraph.RESET;
Paragraph.SETRANGE("Reimbursement Paragraph",Group."Reimbursment Paragraph");
IF Paragraph.FINDSET THEN
REPEAT
IF ItemFilter <> '' THEN
ItemFilter += '|'+Paragraph."Item No."
ELSE
ItemFilter := Paragraph."Item No.";
UNTIL Paragraph.NEXT = 0;

Product.SETFILTER("Product ID",ItemFilter);
SearchPage.LOOKUPMODE(TRUE);
SearchPage.LoadRecords(Product,Item,Rec."Type of Pick");

in the loadrecords I have a copyfilters from Product then I open the page with the result of the filter of copyfilters.
does anyone knows a way to do this?

Answers

  • Options
    TallyHoTallyHo Member Posts: 383
    edited 2020-03-03
    You can avoid the filter bij marking the item records in the paragraph loop.
    Then set markedonly(true) to this record before running the lookup page.
    Settableview first.
  • Options
    fernandojsdiasfernandojsdias Member Posts: 5
    I already think in that solution, but the problem here is that I used the same page for other processes and the source table of the page is a temporary table, the records are created with the filters.
    Thanks anyway ;)
  • Options
    TallyHoTallyHo Member Posts: 383
    Well why don't you fill a temp item rec with items in the loop, pass the temp rec as var tot the page. Then use copy(sourcetavle,tempitem,true) in the page to create the temp records in the source table.
  • Options
    A_l_e_xA_l_e_x Member Posts: 4
    hello i should rewrite the repeat as following:
    IF (Rec."NO ProdGruppe" <> '') AND (Rec."Item No." = '' ) THEN BEGIN
      Group.RESET;
      Group.SETRANGE(Group,Rec."NO ProdGruppe");
      IF Group.FINDFIRST THEN BEGIN
        Paragraph.RESET;
        Paragraph.SETRANGE("Reimbursement Paragraph",Group."Reimbursment Paragraph");
        IF Paragraph.FINDSET THEN Begin
          REPEAT
            IF Product.get(Paragraph."Item No.")THEN
              Product.Mark(TRUE);
          UNTIL Paragraph.NEXT = 0;
        END;
        Product.reset;
        Product.Markedonly;
        SearchPage.LookupMode(true);
        Searchpage.Settableview(Product);
        SearchPage.Run;
        .....
      End;
    End;
    
Sign In or Register to comment.