Calling a report and specifying only 1 invoice copy to print

emulsifiedemulsified Member Posts: 139
I have the following code in one of my reports, it runs a report 50006 which is just an invoice form but I need to make sure I get only 1 copy of the invoice. The report itself has an integert variable in it named NoOfCopies. How do I properly pass the fact that I want only 1 copy to that variable which is in report 50006 via REPORT.RUN ? So my question is how do I pass NoOfCopies := 1 to report 50006 ?


IF PrintRecord THEN BEGIN
// RecordsToPrint := RecordsToPrint + ',' + "Sales Invoice Header"."No.";
// MESSAGE(RecordsToPrint);

RecordsToPrint := "Sales Invoice Header"."No.";
"Sales Invoice Header".SETRANGE("No.",RecordsToPrint); // set the filter
REPORT.RUN(50006, FALSE, FALSE, "Sales Invoice Header");
"Sales Invoice Header".SETRANGE("No."); // clear the filter
END;

If I can't pass the value to the report 50006 then I guess I can just duplicate the report and use the modified one instead but I don't want to do that when I could possibly just send a variable and use 1 less object up.
Half-empy or half-full how do you view your database?

Thanks.

Comments

  • KYDutchieKYDutchie Member Posts: 345
    Hi,

    what you could do is assign your report to a variable, then create a trigger in your report that sets the number of copies.
    IF PrintRecord THEN BEGIN
    // RecordsToPrint := RecordsToPrint + ',' + "Sales Invoice Header"."No.";
    // MESSAGE(RecordsToPrint);
    
    RecordsToPrint := "Sales Invoice Header"."No.";
    "Sales Invoice Header".SETRANGE("No.",RecordsToPrint); // set the filter
    CLEAR(R50006);
    R50006.SETNUMBEROFCOPIES(1); //This is your new trigger in your report.
    R50006.USEREQUESTFORM(FALSE);
    R50006.SETTABLEVIEW("Sales Invoice Header");
    R50006.RUN;
    "Sales Invoice Header".SETRANGE("No."); // clear the filter
    END;
    

    Hope this helps.

    Willy
    Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
Sign In or Register to comment.