Copying filters within same report


I am creating a report in NAV2013. It consists of 2 parts. The first part is a list of posted sales invoices which the user filters using ‘Bill-to Customer No.’ and ‘Posting Date’. This is working fine. The second part (but on the same report) is a list of posted sales credit memos. I would like to copy the filters that the user applies to the sales invoices so that they also become the filters for the sales credit memos. Simply, the report should list invoices and credits for a particular list of customers through a particular posting date range but I don’t want to trust the user to input the filters twice, so I would like to copy them.

I can see COPYFILTER, COPYFILTERS and SETFILTER but I can’t figure out the correct syntax. A little help from you guys-in-the-know would go a long way to helping me.

Thanks in advance,


USE Copyfilters for the same

Check following link

Hi Amol

Thanks for your consistent help on this forum.

I have read the article you suggested earlier but something isn’t clicking. On my report I have defined a text variable as ‘InvHeadFilters’ and I have the following line of code in the OnPreReport section:

InvHeadFilters := “Sales Invoice Header”.GETFILTERS

I use this to display the filters on the report, which is working for the invoices. From this article, should I also have this line?:

“Sales Cr.Memo Header”.COPYFILTERS(“Sales Invoice Header”)

Thanks again,


I’ve tried the above but get an error when running the report:

"Copying all filters at once can only be done between records that belong to the same table.

Table: Sales Cr. Memo Header ← Sales Invoice Header

Copy the necessary filters individually"

This is, at least, the first time I’ve been able to get the thing to compile without a syntax error so I feel like I’m making progress. Any advice on the above?



As per your above question you said you want to copy filters from one table to another so you can use only

“Sales Cr.Memo Header”.COPYFILTERS(“Sales Invoice Header”)

I could be mistaken, but I’m pretty sure that COPYFILTERS only works when the source and target variables are based on the same table object. If you are working with t_112 Sales Invoice Header and t_114 Sales Cr.Memo Header, COPYFILTERS will not work. In this case, you’ll need to inspect the filters on the source table at the individual field level and then assign the filters to the target table in the same way. You can either create a function that has hard-coded interrogations of all the fields you’re interested in, or you can get creative and use recref and fieldref to create a generic function. And, you may need to take FILTERGROUP into consideration depending on your circumstances.

Hi Amol/George

Thanks to you both for your assistance.

Amol, I am copying filters between different tables so it seems the COPYFILTERS will not work. But thanks for clarifying the syntax of this command - I think it will be useful in the future.

George, I think you are right. I’ve copied the filters separately (hard coded) and this is working OK. I’ll take a look at your ‘creative’ suggestion at another time but for the moment, thanks for providing the solution.

Thanks again for your assistance in sorting this out.