Filtering reports

Hi all, long time ago I didn’t connect… I got a question about reports, that’s the situation:

I have a report displaying on page 1 a summary of invoiced out of date by customer, and the detail of everyone on the rest of pages.

I calculate de summary by code, but filters of “Due Date” are on DataItem “Cust. Ledger Entry”… I try to copy the filter for the code but no filter is available for “Cust. Ledger Entry” on “Customer” dataitem. The line I use is: COPYFILTERS(“Cust. Ledger Entry”)

How can I get this filters before using the dataitem?. Thanks

Hi Galletin,

Welcome back!

If I am reading this correctly:

I would use the GETFILTER and SETFILTER commands as the COPYFILTERS will only work in the fields are the same so it’s trying to apply the Due Date filter on the customer where it should be “Date Filter”

Hi DaveT,

filter is applied to the same table “Cust. Ledger Entry”, but one is a DataItem of the report and the other one is a local var. The problem is that I use CustLedgEntry.copyfilters(“Cust. Ledger Entry”) but “Cust. Ledger Entry” data item has no filters, even if I inform them on the request form.

Maybe the question could be… how can I access the filter values of a data item on a previous data item? Hope I explained better :wink:

The question could be other way round:

How could you prevent the user from applying a filter to the “Cust. Ledger Entry” dataitem and enter the filter on the customer table instead?

Which means:
Instead of entrering the “Due Date” filter on the CLE let the user enter the date filter on the customer dataitem. Then you can copy the filter to the variable and the CLE data item.

On the other hand, did you try to check the filter of the CLE dataitem in the OnPreReport section? I think I remember that it worked for me one day.

Check how you wnat the machine to work.

Do you start with the customer record and then progress to the details or ?

I suggesr the report data items should be Customer then an indented Customer Ledger Entry. Allow filters on customer but do not allow filters on the CLE.

Set the filter fields on Customer to Date Filter and then use GETRANGE to apply those filters that YOU need to the CLE.

Good luck.

Thanks for your replies. I’m afraid I don’t really understand the reason you write of Date Filter, this flowfilter is relationed with the Posting Date not with the Due Date, surely I didn’t understand.

On the other hand I found a curious thing, “Cust. Ledger Entry”.GETFILTERS works on PreReport but not on OtherDataItem.OnAfterGetRecord… I can use vars to get the values on PreReport and apply everywhere but I think is working twice.

Thanks anyway

Hi again.

Basically you are right that the flow filter field “Date Filter” in the customer has an impact at a number of flow fields in the customer.
But on the other hand you can also retrieve the filter set to this field and apply it somewhere else:

CustLedgEntry.SETFILTER(“Due Date”, Customer.GETFILTER(“Date Filter”));

It also makes sense that the GETFILTERS only works in the OnPreReport trigger as the filters are being changed for every subsequent dataitem (like customer ledger entry is dependant on the customer).

Three things to mention:

1.) The reason, why all data item filters (even those of the indented data items) are available in the OnPreReport trigger is, that one should have the possibility to print all filters set by users, for example in a header section on page 1. (As was noted before, the data item filters are available only in that trigger)

2.) There are flow fields in the customer table that use “Date Filter” with respect to “Due Date”, for example the field “Balance Due”

3.) Instead of
CustLedgEntry.SETFILTER(“Due Date”, Customer.GETFILTER(“Date Filter”));
one can also write:
Customer.COPYFILTER(“Date Filter”,CustLedgEntry.“Due Date”);