Report/Request Form

Is there any way to get the Rec passed to a report using RUNMODAL(REPORT_ID, TRUE, FALSE, Rec) on the Request Form? Even if I can get the filter that shows up (and then I can get the record myself) that would be okay. E.g. If I run the Purchase Order Report from the Purchase Order Form, the Request Form shows the No. Filter for the specified Rec. Can I get this Filter? I can’t figure this out because when the Request Form runs the Purchase Header record is empty. Also, is there a way to save off the options selected in the Options tab of the Request Form without the user having to close the Report? I’ll explain what exactly I’m trying to do: I call the report from a form. When the Request Form shows up, the user picks their options on the Options tab. If they click e-mail report, I want to recall the report (I have to do this so the Printer Dialog doesn’t show up). But I need the initial record, and the subsequent call to the report has to pick up any options that they had selected. Please let me know if I can clarify anything that would help somebody understand the problem better. Any help is greatly appreciated. Thanks, Mark.

Mark, As for the question of Purchase Order Report, see the code example of ‘Print…’ button:

DocPrint.PrintPurchHeader(Rec);
. . .
Codeunit:: Document-Print
PROCEDURE PrintPurchHeader(PurchHeader: Record 38);
    VAR
      ReportSelection : Record 77;
    BEGIN
      **PurchHeader.SETRANGE("No.",PurchHeader."No.");**
      PurchSetup.GET;
      . . .
      REPORT.RUNMODAL(ReportSelection."Report ID",TRUE,FALSE,**PurchHeader**)
      . . .

Therefore, you have the “No.” Filter for the specified Rec. See the information from C/SIDE Reference Guide ------------------------------------------------------------------------------- REPORT.RUNMODAL . . . REPORT.RUNMODAL(Number [, ReqWindow] [, SystemPrinter] [, Record]) . . . Data type: record Tells the system which record to use in the report. The system will use any filters attached to the record you specify. . . . ------------------------------------------------------------------------------- So, you have to obtain filter settings from the current record. You can do it by GETFILTER function. The function syntax is

String := Record.GETFILTER(Field)

After that, you have to apply this filter before REPORT.RUNMODAL execution. As for the way of the information from the “Options” tab storing/retriving, it is possible via additional table. Regards, Yuri Pokusaev IBS, Senior Consultant NCPS, NCSD ypokusa Edited by - ypokusaev on 2001 Nov 22 20:49:23

Thanks Yuri, The problem (unless I’m missing something, which is quite possible) is that on the Reports Request Form the Purchase Header record is empty (even though it was called through PrintPurchHeader in the Document-Print codeunit). I can see the filter, but when I try “Purchase Header”.GETFILTER(“No.”) it returns nothing because “Purchase Header” is empty. It seems to me that the Purchase Header record is not available until the report is actually run (through selecting Print or Preview). I did find another solution though (not ideal) and that is to create a procedure in the report (say SetVars(rec)) and before the report is called, call report.SetVars. I would like to not have to do this though because that means I have to change the Document-Print codeunit. As for my other problem, are you suggesting that I should create a table like “Purchase Order Report Request Form Properties” and store those in there. Just want to be clear. It may be the only way, but I was hoping that something else might do the trick before I start using up valuable tables (we only have a license for a limited number). Thanks Again, Mark.