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

  • 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
    Amol Salvi 18,694 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
    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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans