How to get applied filters from a report ?

Is there is the way to receive applied filters from a report ? Example: I have a record, I want to run the report’s request form for user to enter some filters. But, after report work is finished, all applied filters are disappeared ! I’ve tried to do it this way: (on the form’s Command button) MARKEDONLY(FALSE); REPORT.RUNMODAL(REPORT::“Add Items”,TRUE,FALSE,Item); MARKEDONLY(TRUE); MESSAGE(FORMAT(COUNT)); (On the corresponding report) OnAfterGetRecord trigger for the DataItem that is pointed on the same table: Item.MARK(TRUE); But the abovementioned MESSAGE gives me 0 !!! What should I do ?

Hi there! Try this instead. Create a new Function in the Report. Set the Return Value to Type:Text(250). In the function, write this code:

 
EXIT(ReportDataItem.GETFILTERS);

Then, in the form you wish to get the filters returned to, you will need to create a Global Variable for your report, and insert the following code into your Command Button:


CLEAR(ReportVariable);
ReportVariable.RUNMODAL;
MESSAGE(ReportVariable.CustomFunctionJustCreated);

When you run this, you will see you will get the filters back. Now, for more complex versions of this, you may need to play around with it a bit, but you get the idea. Regards! Kristopher Webb Kelar Corporation, Canada Edited by - Kristopher on 2002 Jun 06 15:42:06

Hi Kristopher, Thank you very much ! But, instead of making of Text variable that has limit of 250 characters I would better pass my Record to the Report’s function as a parameter: ReportVariable.RUNMODAL; ReportVariable.GetAppFilters(MyRec); And in the GetAppFilters function : MyRec.COPYFILTERS(CurrentRecord); Thanks again! DMC