Empty file - dataport

Srivas
Member Posts: 89
I am importing csv file from a dataport and then copy the file to a different folder.
It imports correctly but the file is empty.
I don't know why the file is empty after import. ](*,)
It imports correctly but the file is empty.
I don't know why the file is empty after import. ](*,)
0
Comments
-
Do you do it manually or through code?0
-
through code0
-
OnAfterImportRecord()
OrderCount := OrderCount + 1;
text constants:
Text0001-> %1 Orders Imported / Would You Like To Delete The File?
FilePath->c:\DataportFile\Completed Import\
OnPostDataport()CurrFile.CLOSE; //don't forget to close! IF CONFIRM(Text0001,TRUE,OrderCount) THEN BEGIN SavedFileName := FORMAT(WORKDATE,0,'<Year4>'+'-'+'<Month Text,3>'+'-'+'<Day,2>')+'.txt'; FILE.COPY(CurrDataport.FILENAME,FilePath+SavedFileName); ERASE(CurrDataport.FILENAME); END;
In this example of moving a file after import to another directory - my new filename becomes the day month year.0 -
I call the dataport from a code unit like this
GLEAdjImport.IMPORT := TRUE;
GLEAdjImport.FILENAME := ImpFile.Path + '\' + ImpFile.Name;
GLEAdjImport.RUN;
And then in code unit itself I move the file to new location
IF COPY("Imp Ready to Process Location" + '\' + ImpFile.Name,"Imp Processed Location" + '\' + ImpFile.Name) THEN
ERASE("Imp Ready to Process Location" + '\' + ImpFile.Name);0 -
have you tried your move from the dataport as i did?
have you tried closing the file before moving it?0 -
0
-
I have taken IMPfile as a record variable of file which donot have close method.0
-
why not just add the code to onpostdataport trigger?
are you obligated to move the file using the codeunit?0
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