Detecting how a report was run and adjusting variables within the report accordingly.

fcormierfcormier Member Posts: 6
I am looking to code a report in Nav 2015 so that it 'knows' how it was run, and adjusts parameters accordingly.

IE. If it is run and PRINTED to paper, automatically detect this and set the PRINTCOMPANY to FALSE. If it is run and PRINTED to PDF, automatically detect this and set the PRINTCOMPANY to TRUE.

(Ie. don't want the users to have the users toggle the boolean manually to select Print Company from a request page, want this 'choice' to be contextual.)

Thanks

Frank

Best Answer

Answers

  • Wisa123Wisa123 Member Posts: 308
    Hi,

    Just create a global function in the report ("Initialize") which sets all the properties accordingly to the parameters. Wherever the Report is called, just pass in your parameters and run the report.

    CLEAR(Report);
    Report.Initialize(p1,p2,p3,...);
    Report.RUN

    A lot of standard reports work like this (for example R790 - Calculate Inventory -- InitializeRequest())
    Austrian NAV/BC Dev
  • fcormierfcormier Member Posts: 6
    If I am understanding your proposed solution correctly, the problem with that approach is that I don't have access to set/pass the parameter in the first place. All the user is doing is 'running' the report and choosing to 'PRINT to paper' or 'PRINT to PDF' or 'PRINT to Excel' or 'PRINT to Word'. I need the report to KNOW which of these the user has selected without having the user manually click an extra control. If the user must manually set a control/parameter in the request page before hitting PRINT, this defeats the purpose.

    Ideally I'm looking at a report property, ie. REPORT.ISPRINTASPDF or REPORT.ISPRINTWORD, etc. and based on the result the report will behave differently.

  • Wisa123Wisa123 Member Posts: 308
    Ok, I obviously misunderstood your first post.

    As far as i know there is no way to achieve what you want without some crappy workaround that involves using the request page to toggle the ways to print instead of the standard button.

    If you find another way to resolve this, make sure to share it here, would be glad to know.



    Austrian NAV/BC Dev
  • fcormierfcormier Member Posts: 6
    SilverX, what you have proposed looks interesting, I think it may work for what I need.

    Thanks.
Sign In or Register to comment.