Copyfilter

stevensteven Member Posts: 5
Hello everybody!
COPYFILTER copy but blanket all the filters from a table to another so I have to copyfilter field by field and not FILTER ON field that I Know that I have filter already set, so I think to get field name from virtual table field
and copyfilter.
How can I use the field fieldName for do this?
I try like below but the system return an error!


RecField.SETRANGE(TableNo, 37);
IF RecField.FIND('-')
THEN
REPEAT
IF RecField.FieldName <> "Sales Line".FIELDNAME("Sell-to Customer No.")
THEN
IF "Sales Line".GETFILTER(RecField.FieldName) <> ''
THEN
"Sales Line".COPYFILTER(RecField.FieldName, SalesLine2.FIELDNAME(RecField.FieldName));

UNTIL RecField.NEXT = 0;

Thanks in Advance
Bye

Comments

  • krikikriki Member, Moderator Posts: 9,118
    Can't you first do the COPYFILTERS and then put the other filters on the table?

    If not, you have to convert the records to a recordreference and then copy the filters 1 by 1.
    "Sales Line".GETFILTER(RecField.FieldName)
    
    Between the ( and the ) must be the field itself. Not a variable with in it the name of the field.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • stevensteven Member Posts: 5
    It Isn't Properly a table, in my case It is a Data Item linked with another, so If i first do copyfilter I lose the link between DataItem!
    I Hope in that solution but i presuppose that don't work!
    Thanks
    Best Regards
  • mrQQmrQQ Member Posts: 239
    doesnt matter, just restore the link afterwards
  • kinekine Member Posts: 12,562
    You can try to copy the filters into another filtergroup to have both set of filters.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.