Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Print another report from the Request Page

Posted on by Microsoft Employee

Hello guys,

I would like to do the following in BC 14:

I have a report 116. In this report there is a request page. There I have added a variable as an option. This is called "PrintOnPaper".

If this option is then checked by the user, that means it is set to the value true, not the report 116 should be printed, but the report 50116.

This is a modified copy of 116.

How can I make this possible?

In the OnitReport-trigger I tried this:

IF PrintOnPaper = TRUE THEN
  REPORT.RUNModal(50116,FALSE,False,"Issued Reminder Header");
CurrReport.SKIP;

Categories:
  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Print another report from the Request Page

    I could solve it, with that code change:

    REPORT.RUNModal(50116,True,False,"Issued Reminder Header");

  • Suggested answer
    Vaishnavi J Profile Picture
    Vaishnavi J 3,056 on at
    RE: Print another report from the Request Page

    Can you send me the code that you have written on both reports?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Print another report from the Request Page

    Ok, if I take your code and run the report 116 (in preview mode).

    Now always opens a window that asks me to save the report.

    If I then enter a file name here, the correct report 50116 is saved on the desktop.

    But I didn't want to save the report, I just wanted to view it in preview mode.

    Why does this no longer work?

    If I then simply call the 50116 report with Run, the preview mode works and I am not prompted to save.

  • Suggested answer
    Vaishnavi J Profile Picture
    Vaishnavi J 3,056 on at
    RE: Print another report from the Request Page

    Hi,

    You don't need to use Report variable and then use Run function

    "Reminder OnPaper".RUN; // this is not required.

    Instead of this use Report.RunModal(Report Id, False, False , Record). Refer the below screenshot.

    pastedimage1645199504678v1.png

    The request page would not run for another report and the data will be pulled based on request page values that you have added before.

    If my answer was helpful to you, please verify it so that other users know it worked. Thank you very much.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Print another report from the Request Page

    This is my current code:

    IssuedReminderHeaderPrint := "Issued Reminder Header".GETFILTERS;

    IF PrintOnPaper = TRUE THEN BEGIN

     "Reminder OnPaper".RUN;

     CurrReport.QUIT;

    END;

    IF I use the parameters of the Run function or RunModal function the programm always tries to save the report to the disk...so I have changed the code a bit.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Print another report from the Request Page

    Thank you very much for your help.

    This already works quite well.

    Only I still have the following problem.

    When I start the report and enter my filter parameters and check the PrintOnPaper field and go to Preview, the request page of the other report opens. This is also correct.

    But here I have to enter again all the filters that I have already entered in Report 116.

    Is there a way to save the filters and pass them to the Request Page 50116?

    Thanks a lot :)

  • Suggested answer
    Vaishnavi J Profile Picture
    Vaishnavi J 3,056 on at
    RE: Print another report from the Request Page

    Hi,

    Set the option values for PrintOnPaper field like the below screenshot.

    pastedimage1645115363549v3.png

    You can add the below logic in the OnPreReport trigger to run the customized report when the field value is yes.

    pastedimage1645115197312v2.png

    If my answer was helpful to you, please verify it so that other users know it worked. Thank you very much.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans