dataport and report dont run in sequence

gulamdastagirgulamdastagir Member Posts: 411
hello navies

i have been trying to run the following code

dataport.RUN(5000);
report.RUN(5000);

but somehow the report(processingonly=yes and Requestform=no) comes up before the dataport..

if i do dataport.RUNMODAL(5000,false) it runs properly however it does not show the request form of the dataport to browse to the input file

thanks
Regards,

GD

Comments

  • MBergerMBerger Member Posts: 413
    just remove the false in your Runmodal call, because by using that you are telling NAV not to show the requestform.
  • matttraxmatttrax Member Posts: 2,309
    Yep. You should explore the differences between RUN and RUNMODAL. The point of RUNMODAL is to stop execution of code and wait for something to happen. RUN just kicks something off and moves to the next line of code.
  • gulamdastagirgulamdastagir Member Posts: 411
    MBerger wrote:
    just remove the false in your Runmodal call, because by using that you are telling NAV not to show the requestform.


    when u run the code dataport.runmodal(5000,yes) you get an error lsomething ike "this error is for CAL programmers .......report.runmodal.....form.runmodal.....dataport.runmodal....use commit...."

    when i excute the code
    dataport.RUN(5000) ;
    report.run(5000);

    the report runs before the Dataport this is strange!
    :shock:
    Regards,

    GD
  • TonyHTonyH Member Posts: 223
    Yep, because you are about to potentially run a routine that (modal) that could sit and wait for the user to interact with the system, so it makes sure you have cleared up (by committing to the database) any outstanding transactions.

    Otherwise the user could walk away from the machine with the request form showing and have locks on different tables.

    After the user comes back from lunch they get lynched by all the other users for locking them out the system.

    So Nav gives you that huge message and stops you from doing it instead!

    t
  • kinekine Member Posts: 12,562
    If you want to run something in sequence, you cannot use .RUN but RUNMODAL. RUN means run and forget, without any chance to assume when it will run... And if you are using RUNMODAL of object with requestform, you need to do it without any running transaction, else you will block all other users. It means, your case is more complex than just talking about why X is running before Y. It is about what you want to do and what is correct way of doing that...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • gulamdastagirgulamdastagir Member Posts: 411
    DATAPORT.RUNMODAL(5000,FALSE);
    REPORT.RUN;
    


    works in the order ->DATAPORT->REPORT

    But it doesnt bring the request form thats my problem because i want the user to be able to browse to the file he wants as input to the dataport.



    the dataport imports the txt file data into a buffer temporary table and the report insert the data from the buffer to the Navision transaction table

    thanks mate
    Regards,

    GD
  • MBergerMBerger Member Posts: 413
    DATAPORT.RUNMODAL(5000,FALSE);
    REPORT.RUN;
    
    But it doesnt bring the request form thats my problem because i want the user to be able to browse to the file he wants as input to the dataport.
    That is because you TELL it not to show the requestform, by setting the second parameter to FALSE !

    If the report is ALWAYS going to be run from the dataport, then why not put it in the OnAfterDataport trigger of the dataport ? Then at least you know it will be run afterward.
  • gulamdastagirgulamdastagir Member Posts: 411
    MBerger wrote:
    If the report is ALWAYS going to be run from the dataport, then why not put it in the OnAfterDataport trigger of the dataport ? Then at least you know it will be run afterward.


    So you think it will force the report to run after the dataport.

    But dont you think in the code
    DATAPORT.RUN(5000);
    REPORT.RUN(5000);
    
    REPORT.RUN(5000)
    
    comes after the Onafterdataport trigger and should have worked in the first place

    Anyways i was thinking of something similar to your solution i will try and let you know.thanks Anyways Mberger
    Regards,

    GD
Sign In or Register to comment.