Thats what I think...
The reports DataItemTableView will set the additional filter into Document Type = CONST(ORDER)) and you won't get Invoices there... Even if you put it OnPreDataItem, the filter in the DataItemTableView will be set.
and do read help about setfilter, setrange, filtergroup and datatableview properties, etc...
it will be much easier to use this functions when you understand them.
Comments
Why did you decide to use code instead of DataItemTableView and what do you mean "affect"?
I have a Sales Order report, with
WHERE(Document Type = CONST(ORDER))
in its DataItemTableView.
I wanted to use this report also for Sales Invoices. What I did in fact was:
SalesHeader.SETRANGE("Document Type",SalesHeader."Document Type");
REPORT.RUN(ReportID,TRUE,FALSE,SalesHeader);
The report's Filter Form now shows this filter (even though "Document Type" is not included in ReqFilterFields) but that's OK.
Alastair
The reports DataItemTableView will set the additional filter into Document Type = CONST(ORDER)) and you won't get Invoices there... Even if you put it OnPreDataItem, the filter in the DataItemTableView will be set.
Not entirely, Gmc.
Affar, you can easily replace DataItemTableView filter by using SETFILTER or SETRANGE OnPreDataItem.
But you should use FILTERGROUP at first.
The matter is that when you use SETRANGE or SETFILTER by default you use FILTERGROUP 0. And the DataItemTableView filter uses FILTERGROUP 2.
So, all you need before SETRANGE is to set FILTERGROUP to FILTERGROUP 2.
Here is the code you should write OnPreDataItem:
delirium
it will be much easier to use this functions when you understand them.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯