I am combining 2 reports in Navision Attain. Both reports are using Item table; one is sorted by “No.” and the other by “Inventory Posting Group”. I named the DataItemVarName as Item and Item1. The ReqFilterFields are setup from DataItemVarName: Item.
In Item1, I have problem when capturing all the filters from DataItemVarName: Item.
OnPreDataItem() I put:
Item. COPYFILTERS(Item1); // this copyfilters doesn’t work.
But, if I put the filter one by one, it’s working but it’s not effective to do it this way
Item.COPYFILTER(“No.”,Item1.“No.”);
Item.COPYFILTER(“Inventory Posting Group”,Item1.“Inventory Posting Group”);
Item.COPYFILTER(“Location Filter”,Item1.“Location Filter”);
Item.COPYFILTER(“Date Filter”,Item1.“Date Filter”);
Item.COPYFILTER(“Customer Filter”,Item1.“Customer Filter”);
Etc…….
What did I missing?
Thanks
ZB
Try modifying your statement so that the Source and Target tables are reversed:
Item1.COPYFILTERS(Item)
That should do the trick.
George,
I’ll give a shot but eager to know the logic behind it. Please explain.
Thanks, ZB
The change I suggested is simply a consequence of the syntax for the function. You can see what I mean by looking at the material in the help file under COPYFILTERS. The function prototype looks like this …
Record.COPYFILTERS(FromRecord).
In your example, Item is the record you’ll be copying filters from, and Item1 is the record you’ll be copying filters to. With that information, substituting Item and Item1 for the generic placeholders in the function prototype, you would see:
Item1.COPYFILTERS(Item);
From your original code snippet, you seemed to have had these two tables in reverse order. I can see where you might get the argument sequence confused, especially when you look at the function prototype for the companion function COPYFILTER (to copy a filter setting on a single field). The syntax for that function seems to be the reverse of the syntax for the COPYFILTERS function, shown here …
SourceRecord.COPYFILTER(FromField, ToRecord.ToField);
This explains why your code worked for copying individual field filters but not for copying the entire record filters.
Hope that helps.
Hi George,
The problem is solved. Thank you very much for taking the time explaning and responding! I really appreciate it!
You’re GREAT!!!
ZB