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
0
Answers
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())
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.
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.
Carsten
==> How To Ask Questions The Smart Way
This post is my own opinion and does not necessarily reflect the opinion or view of my employer.
Thanks.