Options

Setrange with another table

How can I filter a table based on a set of values of another and different table?
for example.
Table1.setrange(name, "peu*");
Table2.setrange(name,Table1.name)...

Thank you!

Answers

  • Options
    rahul_jnkrahul_jnk Member Posts: 61
    Have you looked into COPYFILTER function?
    https://msdn.microsoft.com/en-us/library/dd355214.aspx
  • Options
    sharon95sharon95 Member Posts: 183
    yes, but the two tables are different...
  • Options
    rahul_jnkrahul_jnk Member Posts: 61
    It will work when tables are different but on one condition that data types must match.

    From the documentation:
    The FromFields and ToFields must be of the same data type, but they do not have to belong to the same table.
  • Options
    Wisa123Wisa123 Member Posts: 308
    edited 2017-04-06
    Table1.setrange(name, "peu*");
    IF Table1.FINDSET THEN REPEAT
    Table2.setrange(name,Table1.name)
    IF Table2.FINDSET THEN REPEAT
    table2.mark(true);
    UNTIL table2.next = 0;
    UNTIL Table1.NEXT = 0;

    Table2.MARKEDONLY(true);

    -> Findset now delivers all the things you need now.
    Assuming i understood your problem :D
    there may be better options to solve this though.

    For more info lookup the mark function on msdn
    Austrian NAV/BC Dev
  • Options
    AlbertvhAlbertvh Member Posts: 516
    Or you could do this
    Table2.SETFILTER(Name,Table1,GETFILTER(Name));
    IF Table2.FINDSET THEN ....
Sign In or Register to comment.