filtering on a record

Hi guys, I have a question about filtering. Here is a situation:
I filter Item table on product posting group:
Item.SETRANGE("Product Posting Group", 'Test');

And what I need now is to filter on Sales Shipment Line table to find all the lines where these items are used. So
SalesShipLine.SETRANGE(Type, SalesShipLine.Type::Item);
SalesShipLine.SETFILTER("No.", Item.GETFILTER("No."):

I have expected this to work, but appereantly GETFILTER does not work, because I have noy applied SETRANGE or SETFILTER on "No." field in Item table. Any ideas how to make it work?

Answers

  • cvanderpoelcvanderpoel Member Posts: 9
    You could create a No. filter textfield loop over the Item.
    IF Item.FINDSET THEN BEGIN
      REPEAT
        NoFilter = Item."No." + '|';
      UNTIL NEXT=0;
    
      NoFilter := COPYSTR(NoFilter,1,STRLEN(NoFilter) - 1);
    
      SalesShipLine.SETRANGE(Type, SalesShipLine.Type::Item);
      SalesShipLine.SETFILTER("No.", NoFilter);
    END;
    


    Depending on how many items, this could be a working solution
  • MaxxMaxx Member Posts: 10
    Should be:

    NoFilter := ''; // to init value
    REPEAT
    NoFilter += Item."No." + '|';
    UNTIL Item.NEXT=0;

    to collect all item numbers instead if last one.
    Am I right?
  • cvanderpoelcvanderpoel Member Posts: 9
    You're right typo
  • krikikriki Member, Moderator Posts: 9,112
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.