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)

Printing Selection

(0) ShareShare
ReportReport
Posted on by

I Have A page which has the possibility to print out four different labels, depending on certain conditions. 

Here's the Item Lot Print Select Page.

93.PNG

What I need to do is essentially as follows (Briefly wirtten with incorrect syntax etc. 

94.PNG


recInvtSetup.FINDFIRST;
recItem.GET("Item No.");
IF "Item Category Code" = 'N 'AND
"Product Group Code" ='ASSY' THEN
REPORT.RUNMODAL(50061,TRUE,FALSE,Rec)
//ELSE
("Product Group Code" = N) OR
("Product Group Code" = T)
THEN BEGIN
REPORT.RUNMODAL(50074,TRUE,FALSE,Rec)
//ELSE
recBinContents.RESET;
recBinContents.SETCURRENTKEY("Item No.");
recBinContents.SETRANGE("Item No.","Item No.");
IF recBinContents.FINDFIRST THEN BEGIN
rptLewistest.SETTABLEVIEW(recBinContents);
rptLewistest.RUNMODAL;
END;

END;

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    UPDATE**

    So far This has worked However The last report isn't printing. I understand I haven't used the most effecient method of writing this but how can I change it to run the last Label (3rd Line from bottom)

    recInvtSetup.FINDFIRST;

    recItem.GET("Item No.");

    PGC := "Product Group Code";

    IF recItem."Item Category Code" = recInvtSetup."Surface Mount Item Cat." THEN  //Works

     REPORT.RUNMODAL(50061,TRUE,FALSE,Rec)

    ELSE IF

    recItem."Item Category Code" = recInvtSetup."Through Hole Item Cat."       //Works

    THEN BEGIN

     REPORT.RUNMODAL(50074,TRUE,FALSE,Rec)

    END ELSE IF

    (recItem."Item Category Code" = recInvtSetup."System Assembly Item Cat.") AND

    (PGC = 'ASSY') THEN BEGIN

    recBinContents.RESET;

    recBinContents.SETCURRENTKEY("Item No.");

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

    IF recBinContents.FINDFIRST THEN BEGIN

     rptLewistest.SETTABLEVIEW(recBinContents);                 //Works

     rptLewistest.RUNMODAL;

     END

    ELSE BEGIN

    REPORT.RUNMODAL(50074,TRUE,FALSE,Rec)         //Doesn't work

    END

    END;

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

    Hi,

    Kindly elborate more on requirement

    Do you want to print labels in report or what exactly want ?/

  • Community Member Profile Picture
    on at

    Hi, Following these statements they should print a different report. However The last two IF statements are both running as technically they both do have the same Item Cat Code. However If one has a Product group code of 'ASSY' It should print a different report (Both reports stated in the code) They all correctly open however when you Print the label corrosponding to this code 


    IF (recItem."Item Category Code" = recInvtSetup."System Assembly Item Cat.") AND
    (PGC = 'ASSY') THEN BEGIN
    recBinContents.RESET;
    recBinContents.SETCURRENTKEY("Item No.");
    recBinContents.SETRANGE("Item No.","Item No.");
    IF recBinContents.FINDFIRST THEN BEGIN
    rptLewistest.SETTABLEVIEW(recBinContents); //Works
    rptLewistest.RUNMODAL;
    END;
    END;

    It is also running this 

    IF (recItem."Item Category Code" = recInvtSetup."System Assembly Item Cat.") THEN BEGIN
    REPORT.RUNMODAL(50074,TRUE,FALSE,Rec); //Doesn't work
    END;

    How can I make it so it doesn't execute the second section of code. Here is the full code 


    CurrPage.SETSELECTIONFILTER(Rec);

    // TIO000001 : BEGIN
    // REPORT.RUNMODAL(50061,TRUE,FALSE,Rec)
    recInvtSetup.FINDFIRST;
    recItem.GET("Item No.");
    PGC := "Product Group Code";
    IF recItem."Item Category Code" = recInvtSetup."Surface Mount Item Cat." THEN //Works
    REPORT.RUNMODAL(50061,TRUE,FALSE,Rec);

    IF recItem."Item Category Code" = recInvtSetup."Through Hole Item Cat." THEN //Works
    REPORT.RUNMODAL(50074,TRUE,FALSE,Rec);

    IF (recItem."Item Category Code" = recInvtSetup."System Assembly Item Cat.") AND
    (PGC = 'ASSY') THEN BEGIN
    recBinContents.RESET;
    recBinContents.SETCURRENTKEY("Item No.");   //if this executes, Don't execute Statement Below
    recBinContents.SETRANGE("Item No.","Item No.");
    IF recBinContents.FINDFIRST THEN BEGIN
    rptLewistest.SETTABLEVIEW(recBinContents); //Works
    rptLewistest.RUNMODAL;
    END;
    END;

    IF (recItem."Item Category Code" = recInvtSetup."System Assembly Item Cat.") THEN BEGIN
    REPORT.RUNMODAL(50074,TRUE,FALSE,Rec); //Doesn't work
    END;

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