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

fcormier
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
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
Best Answer
-
From my knowledge, you cannot check for the report format in C/AL, but you can in the report itself and show/hide fields/areas depending on the output format. Have a look at Globals!RenderFormat aka Renderer Dependent Report Layout.Cheers
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.5
Answers
-
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 Dev0 -
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.
0 -
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 Dev0 -
From my knowledge, you cannot check for the report format in C/AL, but you can in the report itself and show/hide fields/areas depending on the output format. Have a look at Globals!RenderFormat aka Renderer Dependent Report Layout.Cheers
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.5 -
SilverX, what you have proposed looks interesting, I think it may work for what I need.
Thanks.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions