Report.RUN doesn't shoot, Report.RUNMODAL does

thoeselthoesel Member Posts: 2
Hi there,

at first: I'm sure I know the differences between RUN and RUNMODAL - that's NOT the question.

Today I experienced a funny phenomenon I want to share with you.

There's a report as a batch function, starting a lookup form, after that form is closed with OK some processing is made (e.g. document release) and after that - still inside that initial report - I ask the user via CONFIRM if she/he wants to print a report.

Thing is that this does not start the report (screen is flickering instead):

IF CONFIRM(Text005, TRUE) THEN
// same result with: REPORT.RUN(50133, TRUE, FALSE, SH);
R50133.RUN;

... but this does:

IF CONFIRM(Text005, TRUE) THEN
// same result with: REPORT.RUNMODAL(50133, TRUE, FALSE, SH);
R50133.RUNMODAL;

Why? I try to avoid the COMMIT before RUNMODAL.

Don't bother about filtering the record SH, that's OK. The debugger shows that not even the initial OnPreDataItem is started in the first case, just Codeunit 1's FindPrinter.

This is in 3.70 hotfix 12 native.

Tom

Comments

  • kinekine Member Posts: 12,562
    May be it is because:

    The report is runned in some context (the object, from where it is called). But if you are using RUN and there is no another code in your calling object, the object is closed, thus the context is "disposed" and all the called objects are disposed too. It means that the started report is disposed when the calling object is closed. And it has just time to run the CU1 FindPrinter but after returning back from that function, the report is no longer in memory and all the objects are closed...

    If you run RUNMODAL, as you know, the calling object is waiting for the report to finish and after that the object is closed.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • EugeneEugene Member Posts: 309
    is your variable R50133 local or global ?
Sign In or Register to comment.