How to import a CSV file from a shared folder in Server?

Aravindh_NavisionAravindh_Navision Member Posts: 258
edited 2010-06-03 in Navision Attain
Hi Folks,

I need your help for the following requirements. My requirements are:

1. I need to import a CSV file from a shared folder in a Server on a daily basis. The shared folder in the server contains the CSV file in the following format, <filename>-mmddyyyy. I need to check the latest file based on SYSTEM DATE or from the NAME OF THE FILE from the shared folder and have to import it into Navision automatically.

2. I need to import a CSV file from the shared folder on a daily basis on a specific time, say 01:00 am. I did a piece of small coding,

Request form > On Timer (trigger) >

DATAPORT.RUNMODAL(<name of the dataport>, FALSE);

and set the Timer Interval property to 60000 (for 1 minute, for 24 hrs 86400000)

From the above, I can only import the CSV file after 24 hrs from the current system time which is not my requirement actually. I need to run it in specific times.

Note: I hope this can be achieved without NAS or Job Scheduler where my license does not support them. I am restricted to use report and dataport only.

Expecting you help at the earliest.

Comments

  • dkonedkone Member Posts: 59
    Hi Aravindh,

    1- Create a code unit that parse your folder. For this, use a record variable of type file then you can find the right file from your folder.

    2- If i well understand, you put a timer on a form and leave NAV client always open ?

    Regards,
    dkone.
  • Aravindh_NavisionAravindh_Navision Member Posts: 258
    Hi dkone,

    Thank you very much for your reply. Actually, I am using client license only. Using that I am resricted to access codeunits and other coding areas except report codings and dataport codings.

    I have found a solution for the first point that I have mentioned and it is working fine. I need solution for the second point i.e., for automatically running the dataport. Defining TimerInterval (60000 = 1 min) property of request form and writing a piece of coding in On Timer trigger as Dataport.RUNMODAL(<Dataport ID>, FALSE) will work. But it is not the actual requirement for me #-o

    I have to define a specific time for running the dataport. I tried with the following coding, but it is not working... ](*,)

    Variable : DataportTime
    Datatype: Time

    Placed a field DataportTime in request form and wrote the coding as,

    if (DataportTime = TIME) then
    Dataport.runmodal(<Dataport ID>, FALSE);


    Please someone help me to overcome this issue.
  • SavatageSavatage Member Posts: 7,142
    this should shed some light for you.. :whistle:
    viewtopic.php?f=23&t=35890
Sign In or Register to comment.