Manipulate Report Print Options from Form Button

shogan@mila.ieshogan@mila.ie Member Posts: 113
Hi all,

I have a tick-box set up on the Purchase Order report's Request Form (Options tab) set up so that when I hit the Print button on a Purchase Order form, it chooses which printer to print on (choice is between standard HP printer and a PDF printer).

The user now wishes to have both a Print and an Email button on the PO main form, and not use the report's tick-box. So now from each button, I must mimic the user ticking the box.

But I am unsure as how to pass a TRUE/FALSE value to the tick box on the report from the form's buttons.

It seems that the Print button runs codeunits, etc. that seem a little bewildering at best, hence why I am asking the question here.

Any help is greatly appreciated.

Thanks!
Stephen

Answers

  • SavatageSavatage Member Posts: 7,142
    I would Create a menu button with the three choices.

    Then each menu item you can deal with seperately.
    1.Print
    2.PDF
    3.Email
    Calling/assigning a report or codeunit or whatever and you have the ability to use code if needed.
  • shogan@mila.ieshogan@mila.ie Member Posts: 113
    Hi Harry -

    There are only two options needed - just Print and Email (as PDF).

    User just wants to click on a button for either, rather than have unnecessary clicks.

    Is there anything I can do to manipulate the tickbox on a report's options tab from a form?

    And thanks a million for getting back to me.

    Stephen
  • SavatageSavatage Member Posts: 7,142
    So you have 1 report and depending on which option is selected from a menu button you want to pass a parameter.

    There are tons of posts about passing parameters.
  • SavatageSavatage Member Posts: 7,142
    Here's a quick test...
    Form 50 Puchase Order
    Add Variable "My Report" Type "Report" Subtype "Parameter Pass test"
    *Pass Parameter test is that report you're trying to run.
    Add a menu Button On The Form - with 2 menu items. (Print & PDF+Email)
    The C/al code under Print is:
    Clear(MyReport);
    MyReport.SetGlobalParameters(0,"Document Type", "No.");
    MyReport.RUNMODAL;
    
    The C/al code under PDF+Email is:
    Clear(MyReport);
    MyReport.SetGlobalParameters(1,"Document Type", "No.");
    MyReport.RUNMODAL;
    
    This will pass either a "0" or "1" to my report.

    In the report "Parameter Pass Test" I've added a function called "GetGlobalParameters"
    Under "Local" I've added
    "PrintType"=Integer
    "DocType"=Integer
    "DocNo"=code

    Under Global I've added
    "vPrintType"=Option(Print,PDF+Email)
    "vDocumentNo"=Code
    "vDocumentType"=Option(Quote,Order,Invoice,Credit memo,Blanket order,ReturnOrder)
    Purchheader->Record->Purchase Header

    In the Request Form (Used to show you that the parameters actually change)
    Drop a textbox - SourceExp="vDocumentNo"
    Drop Two Option Buttons - Sourcexp="VPrintType" for both & One has OptionValue="Print" & The Other has OptionValue="PDF+Email"
    You can even Drop another Option Button if you want to see..
    SourceExp="vDocumentType" Option Value="Order"
    Do the others if you wish.

    Save. Now when you click the menubutton from the purchase header - it will open the report and you will see the document type & document no as well as the print type is passed.

    See Vid Here: http://www.youtube.com/watch?v=HrgJ81YzeVc
    Incorporate something similar to your stuff & You are on your way.
    Use this Knowledge Wisely & Go Forth Young Developer! :mrgreen:

    Here's the mini report in used in the vid: https://docs.google.com/document/d/1SwG ... dit?hl=en#
  • shogan@mila.ieshogan@mila.ie Member Posts: 113
    Hi Harry,

    Thank you so much for your input.

    Problem is I am a Java developer by default, so getting my head around NAV is quite a mind-bender, especially when you are looking at code that has been customised since 1993!

    I have seen and attempted to code with the passing of a parameter, and that would be fine say if it was passing a parameter from a form to a report, but I have seen very little in terms of passing a parameter to the Request Form of a report, and that is what is confusing me, especially with the button calling out to codeunits, etc.

    I'll will give what you suggested a go - I will still try for separate buttons though, as a drop-down list is a no-go with the user (a director of the company!).

    Will let you know how I progress over the next day or so (I am an IT admin supporting a selection of various systems and not just NAV).

    Regards,
    Stephen
  • SavatageSavatage Member Posts: 7,142
    I video shows the options on the request from changing.
    I passed from form to report 3 things:
    The Order No, The Order Type & The "PrintType" Option

    I just did that to show you visually that they do change. But If you are passing parameters to the report - you don't need a request form. If the user wanted a request form then you can keep your report as it is.

    PS I like the menu item button over 2 command buttons for cleanliness & organization. You can add other options in the future if needed like Fax or Scan, etc.

    Good Luck hope it works out for you.
  • shogan@mila.ieshogan@mila.ie Member Posts: 113
    Thanks Harry. I got it in the end!
  • SavatageSavatage Member Posts: 7,142
    Glad you finally got it working :thumbsup:
Sign In or Register to comment.