web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Print a Report

(0) ShareShare
ReportReport
Posted on by

I'm trying to setup an action button to print a label. I've created the button on the page actions, declared a variable with my report name and used this code under the action button 


recBinContents.RESET;
recBinContents.SETRANGE("Item No.", "Item No.");
rptLewistest.SETTABLEVIEW(recBinContents);
rptLewistest.RUN;

However when I attempt to open the page which should allow me to preview the report nothing is loading? 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Binesh Profile Picture
    7,885 on at

    recBinContents.RESET;

    recBinContents.SETCURRENTKEY("Item No.");

    recBinContents.SETRANGE("Item No.", "Item No."); //Testing purpose filter one ITEMNo

    IF recBinContents.FINDFIRST THEN BEGIN

      rptLewistest.SETTABLEVIEW(recBinContents);

      //rptLewistest.RUN;

     rptLewistest.RUNMODAL;  it carried the filters

    END;

  • Community Member Profile Picture
    on at

    Hi Thankyou however when I click the button nothing appears to be happening.. As if the RUN function isn't working properly.

  • Andrea Antoniazzi Profile Picture
    285 on at

    Hi Lewishhh,

    try with recBinContents.SETFILTER("Item No.", "Item No.");

    Best regards.

  • Suggested answer
    Binesh Profile Picture
    7,885 on at

    Debug that code and check it find records or not, if find then definitely report will run.

    But also check report which you want to execute, report request page, and layout, first run from development environment/custom Report Layout

    Note, Report must have recBinContents dataitem

    See this image its tested.

    reportmodal.png

  • Suggested answer
    Tharanga Chandrasekara Profile Picture
    23,118 on at

    Try running below code,

    recBinContents.RESET;
    recBinContents.SETCURRENTKEY("Item No.");
    recBinContents.SETRANGE("Item No.", "Item No.");
    IF recBinContents.FINDFIRST THEN BEGIN
    REPORT.RUNMODAL(RepNo,recBinContents); // add your report no
    END;


    If the code is not working then debug the code and you will be able to find the issue in it.

  • Suggested answer
    Amol Salvi Profile Picture
    18,698 on at

    Hi,

    Kindly debug and check whether you are getting the record to display for the report

  • Community Member Profile Picture
    on at

    Thank you, The reports button's working now, however when you select preview and enter the No of labels etc it get stuck, attempting to load thousands of rows.86.PNG

    Do you know what the potential cause for this is? 

  • Suggested answer
    Tharanga Chandrasekara Profile Picture
    23,118 on at

    Check on the dataset and filter it for only the necessary record. Plus try changing to RUN without RUNMODEL. When you have the RUNMODEL application wait till the report process over.

  • Community Member Profile Picture
    on at

    H Thank you, I'm still very unsure what's casuing the report to not load.

    Here is my Code on the Button to show the report..

    recBinContents.RESET;

    recBinContents.SETCURRENTKEY("Item No.");

    recBinContents.SETRANGE("Item No.","Item No.");

    IF recBinContents.FINDFIRST THEN BEGIN

     rptLewistest.SETTABLEVIEW(recBinContents);

     rptLewistest.RUN;

    END;

    here is the Datasets, Both Bin Contents and Item ledger are required. 

    88.PNG

    Here's the properties for The Bin Contents Data Item, I think maybe the DataItemTableView is wrong? 

    88.PNG

    Feedback is greatly appreciated! :)

  • Andrea Antoniazzi Profile Picture
    285 on at

    Hi Lewishhh,

    I think the report is processing all the Item Ledger Entries; this is the reason why you receive so much lines.

    If you don't need the Item Ledger Entry DataItem, you have to remove it.

    In the DataItemTableView remove WHERE(Item No.=CONST())

    Best regards

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans