Options

Job Scheduler & Dataports Setting

pangpang Member Posts: 13
I am trying to do a setup to run dataports on Job Scheduler. We added a file path for each job so the dataport request form doesn't need to be shown.

Does any one know if I have to change the dataport to make the UseReqForm set to false? I know this will work. And Looks like it can't be changed by the code. But the customer also like to manually run the dataport in the mean time. So now looks like I have to make a copy of each dataport for running it manually.

Any suggestion will be appreciated.

Comments

  • Options
    DaveTDaveT Member Posts: 1,039
    Hi Pang,

    You could create a codeunit ( or report ) to run the dataports in the job scheduler and use

    dataport.run( number, false );

    Where number is the dataport number and false turns off the request form
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • Options
    pangpang Member Posts: 13
    Thanks Dave,

    But this way I couldn't pass through the file path in there. The idea is to set the path outside of the codeunit.

    I did a report to run through all the scheduler and read all the files under the path use file table.

    ImpFile.RESET;
    ImpFile.SETFILTER(Path,DELCHR(FilePath,'>','\'));
    ImpFile.SETRANGE("Is a file", TRUE);

    dptImp.FILENAME := ImpFile.Path + '\' + ImpFile.Name;
    dptImp.RUNMODAL;
  • Options
    DaveTDaveT Member Posts: 1,039
    Hi Pang,

    You can solve this by using the
    dataport.run( number, false );

    and then in the dataport in the onpredataport trigger put
    IF CurrDataport.FILENAME = '' THEN
       CurrDataport.FILENAME := 'c:\davetest.txt';
    

    and lookup the filename as you were doing.

    This will allow the user to run manually and select their own file.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • Options
    pangpang Member Posts: 13
    The customer want to run a bunch of files under a folder. That's why I use the file table.

    And if I add the file table loop to the dataport, I need to do it for maybe 10 dataports. And I am not sure if it will work for manually running. e.g. select single file.
  • Options
    DaveTDaveT Member Posts: 1,039
    Hi Pang,

    Then another suggestion - generate output to a fixed filename/path and rename it when dataport is finished
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • Options
    krikikriki Member, Moderator Posts: 9,098
    If you want to run the jobscheduler from a NAS, you CAN'T use dataports. You need to convert them to a codeunit or a report.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.