Skip to main content

Notifications

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

  • Community Member Profile Picture
    on at
    RE: Printing Selection

    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;

  • Suggested answer
    Amol Salvi Profile Picture
    18,698 on at
    RE: Printing Selection

    Hi,

    Kindly elborate more on requirement

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

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Printing Selection

    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;

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics NAV (Archived)

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2

#1
mmv Profile Picture

mmv 2

#1
Amol Salvi Profile Picture

Amol Salvi 2

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans