Invoking a function in a dynamically assigned report

rocksoftrocksoft 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.

Comments

  • kinekine Member Posts: 12,562
    You cannot. You need to create some workaround. What you are passing through the function?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • BeliasBelias Member Posts: 2,998
    <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!
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • rocksoftrocksoft Member Posts: 3
    Thank you! This was exactly the solution I needed and everything works just fine! Again, thanks.
  • Benno67Benno67 Member Posts: 39
    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?
    Benno
Sign In or Register to comment.