Import data from text file and insert into Navision table

anilkumar
Member Posts: 136
Hi Experts,
Can any one help me, how to import data from text file and insert/modify the values of the existing navision tables, but not using dataports.
Anyone had got any idea, how to handle this issue..........
Can any one help me, how to import data from text file and insert/modify the values of the existing navision tables, but not using dataports.
Anyone had got any idea, how to handle this issue..........
Anil Kumar Korada
Technical Consultant
Technical Consultant
0
Comments
-
What do you have access to? Reports? Codeunits? Any CAL code?
If you have an access to CAL code then you will have to write a program to read file and insert records in the table manuallyBest Regards,
Oleg0 -
any CAL/Code sample example pleaseAnil Kumar Korada
Technical Consultant0 -
What's wrong with dataports? You can create a dataport in about 10 minutes, programming a codeunit to import from a textfile takes hours.0
-
DenSter wrote:What's wrong with dataports? You can create a dataport in about 10 minutes, programming a codeunit to import from a textfile takes hours.
I have the same problem: ok, the dataport is very good for import a text file, but it's possible to launch dataport in automatic manner without user intervent ?
I must control a directory at regular interval (every hour) and if there are text files in my "rx directory" I must import to navision table.
This process must be totally automatized; there isn't user intervent.
Thanks anakin
Excuse me for my bad english :oops:0 -
You can use the job scheduler to run jobs automatically at user-defined intervals. For the job you want the scheduler to run, you must specify which object (report, dataport or codeunit) carries out the job and when you want to run it.0
-
Savatage wrote:You can use the job scheduler to run jobs automatically at user-defined intervals. For the job you want the scheduler to run, you must specify which object (report, dataport or codeunit) carries out the job and when you want to run it.
In my "Job Queue Entry Card" I can choose only report e codeunit, not dataport0 -
anakin wrote:Savatage wrote:You can use the job scheduler to run jobs automatically at user-defined intervals. For the job you want the scheduler to run, you must specify which object (report, dataport or codeunit) carries out the job and when you want to run it.
In my "Job Queue Entry Card" I can choose only report e codeunit, not dataport
Create a report, to look for the file, if there is a fle to import, you can then using the dataport as a variable, set the filename, set it as Import, and then run the dataport from the job scheduler!Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
>> Create a report, to look for the file, if there is a fle to import...
What's the mean of "Create a report, to look for the file" ?
- Must be a non printing report ?
- What trigger I must coding ?
- Can you post a report trigger code sample ?
Thanks, anakin0 -
Create a Process Only report, and on pre report you run your code, you need to use variables, for your Dataport, and in a setup somewhere hold the path to where your files are stored, also a path to move the files to after Import.
Here is a small part of the code, this will Import and Move the first file, but you will need to code to move Invalid files.
The reason this only brings in one file at a time is because we are using RUNMODAL for the dataport, this means the dataport will run and close the file before we move it.
MyFiles is a variable Type = Record and Name = FileMySetup.GET; MySetup.TESTFIELD("File Path"); MySetup.TESTFIELD("History File Path"); MyFiles.SETRANGE(Path,MySetup."File Path"); MyFiles.SETRANGE("Is a file",TRUE); IF MyFiles.FINDFIRST THEN BEGIN FileName[1]:=MySetup."File Path"+MyFiles.Name; FileName[2]:=MySetup."History File Path"+MyFiles.Name; CLEAR(MyDataPort); //Code Here to set the filename and Run the dataport MyDataport.FILENAME := FileName[1]; MyDataport.IMPORT := TRUE; MyDataport.RUNMODAL; //This code will move the file to history IF FILE.EXISTS(FileName[1])THEN FILE.RENAME(FileName[1],FileName[2]); END; CurrReport.BREAK;
DavidAnalyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
Thanks for all,
but if I use a codeunit instead of report is the same ?0 -
anakin wrote:Thanks for all,
but if I use a codeunit instead of report is the same ?
Yes, sure use a codeunit, reports were often used as default because the Client often had Reports but not Codeunits on the licence.
DavidAnalyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
David Cox wrote:Create a Process Only report, and on pre report you run your code, you need to use variables, for your Dataport, and in a setup somewhere hold the path to where your files are stored, also a path to move the files to after Import.
Here is a small part of the code, this will Import and Move the first file, but you will need to code to move Invalid files.
The reason this only brings in one file at a time is because we are using RUNMODAL for the dataport, this means the dataport will run and close the file before we move it.
MyFiles is a variable Type = Record and Name = FileMySetup.GET; MySetup.TESTFIELD("File Path"); MySetup.TESTFIELD("History File Path"); MyFiles.SETRANGE(Path,MySetup."File Path"); MyFiles.SETRANGE("Is a file",TRUE); IF MyFiles.FINDFIRST THEN BEGIN FileName[1]:=MySetup."File Path"+MyFiles.Name; FileName[2]:=MySetup."History File Path"+MyFiles.Name; CLEAR(MyDataPort); //Code Here to set the filename and Run the dataport MyDataport.FILENAME := FileName[1]; MyDataport.IMPORT := TRUE; MyDataport.RUNMODAL; //This code will move the file to history IF FILE.EXISTS(FileName[1])THEN FILE.RENAME(FileName[1],FileName[2]); END; CurrReport.BREAK;
David
>>MyDataport.RUNMODAL;
this line show the form for select the file to import, but I don't see this form because the file to import is set by FILENAME property and the import must not require user intervent0 -
Use the force...
Or set Dataport property UseReqForm to No0 -
if you use the NAS with the parameter JOBQUEUE to start a codeunit or a report which calls a dataport, the Job Queue Response says:
"You cannot use C/AL variables of type DATAPORT when running the Microsoft Dynamics NAV Application Server."
is there any solution to fix this problem ?
surely i can create a report which imports the file but this means a lot of extrawork.0 -
bluesky29 wrote:if you use the NAS with the parameter JOBQUEUE to start a codeunit or a report which calls a dataport, the Job Queue Response says:
"You cannot use C/AL variables of type DATAPORT when running the Microsoft Dynamics NAV Application Server."
is there any solution to fix this problem ?
surely i can create a report which imports the file but this means a lot of extrawork.Torsten
MCP+I, MCSE NT, Navision MCT (2004,2005)0 -
I have the same problem.
I wrote 10 complex dataport and I have this message using Job Scheduler.
Is there any solution without rewrite the dataport as report?
](*,)
Andy0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions