Invoking a function in a dynamically assigned report

rocksoft
Member Posts: 3
Hi, I need some help on the following problem:
Before I start a report I have to set a variable in that report. This is quite simple:
<reportvariable>.funcSetValue(value) // and then
<reportvariable>.RUN(parameters)
My problem is now that I cannot use a fixed report variable, because the report ID comes from a table
and is only known at runtime. We're talking about Codeunit 229 Document-Print, e.g. PrintSalesHeader().
Of course I can start the report using REPORT.RUN(reportid) but I don't know how to invoke
the setting of the variable as stated in the first code line above when the report ID has to be set dynamically.
I even attempted such code as REPORT.subtype := reportid which obviously made Navision laugh at me ;-((
still I can't create a global report variable without entering a valid subtype.
So any help would be gladly appreciated. Thank you.
Before I start a report I have to set a variable in that report. This is quite simple:
<reportvariable>.funcSetValue(value) // and then
<reportvariable>.RUN(parameters)
My problem is now that I cannot use a fixed report variable, because the report ID comes from a table
and is only known at runtime. We're talking about Codeunit 229 Document-Print, e.g. PrintSalesHeader().
Of course I can start the report using REPORT.RUN(reportid) but I don't know how to invoke
the setting of the variable as stated in the first code line above when the report ID has to be set dynamically.
I even attempted such code as REPORT.subtype := reportid which obviously made Navision laugh at me ;-((
still I can't create a global report variable without entering a valid subtype.
So any help would be gladly appreciated. Thank you.
0
Comments
-
You cannot. You need to create some workaround. What you are passing through the function?0
-
<Credit to Kriki for this post>
i discovered this nice trick: you can use singleinstance codeunit to set your parameters, then just retrieve these parameters for example in the onprereport trigger.
If this report can be run user-side, also remember to clean your singleinstance codeunit after the execution of the report, if you want this behaviour to happen only when calling from cu 229.
Here's the link to the topic, start to read from the last posts of the first pages: it talks about the forms, but the principle is the same. (unfortunately, you can't use the wonderful "sharetable" parameter of copy function in your case, because reports run on a real -not temporary- tables)
http://www.mibuso.com/forum/viewtopic.php?f=5&t=20084&hilit=singleinstance&start=0
enjoy!0 -
Thank you! This was exactly the solution I needed and everything works just fine! Again, thanks.0
-
Hi All
Yes you can?
If you publisch te codeunit as a websebservice you can adress it's functions with a variable.
Validating the function names (the values of the used variable) will require processing of the WSDL of the service.
So we can?
Benno0
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