Report Return Value Standard As Codeunit

andy76andy76 Member Posts: 616
Hello,

is not possible to have a return value from a report in a manner similar to a standard codeunit call:

[Ok] := Codeunit.RUN(Number [, Record])

If Ok is...
It means that...

TRUE
No errors occurred

FALSE
An error occurred during the execution of the codeunit


To evitate runtime error and manage them?

Thank you

Comments

  • EugeneEugene Member Posts: 309
    No, you have to run your report from a codeunit to do it
  • andy76andy76 Member Posts: 616
    I already have a codeunit that launches more report as following

    REPORT.RUNMODAL(123);
    REPORT.RUNMODAL(234);
    REPORT.RUNMODAL(345);
    REPORT.RUNMODAL(543);
    ....
    REPORT.RUNMODAL(8978);

    I want that, if a report, fails the following ones are run otherwise all processing of the codeunit is skipped for error.

    Thank you
  • EugeneEugene Member Posts: 309
    try this:

    in your codeunit define variables for your reports
    Rep123, Rep234 ...
    and run reports as follows:
    Rep123.RUNMODAL
    IF Rep123.ExecutedOk THEN BEGIN
      Rep234.RUNMODAL;
      IF Rep234.ExecutedOk THEN BEGIN
        ...
      END;
    END;
    

    here ExecutedOk is your defined function in each report something like this:
    EXIT(bExecutedOk)
    

    and bExecutedOk is boolean global variable defined in each report and set to true in its OnPostReport trigger. Here i assume that everything went ok if your code reached the end of OnPostReport trigger
Sign In or Register to comment.