How to know that a dataport successfully finished

KeithMMoore
Member Posts: 59
I am running a routine that examines a directory of text files, imports the files via dataport and then moves the files to an archive directory. I want to be able to confirm that an instance of the dataport succeeded and commit it so that the imported file can be moved or, if it failed, that the process can continue on to the other files.
I saw some old code here from 2006 about "IF dataport.RUNMODAL THEN" but that does not work in 4.06. What are some other ways people have used to confirm that a dataport executed successfully? Thanks.
I saw some old code here from 2006 about "IF dataport.RUNMODAL THEN" but that does not work in 4.06. What are some other ways people have used to confirm that a dataport executed successfully? Thanks.
0
Comments
-
4.06?
What version is that?
AFAK the IF .RUNMODAL THEN works in all versions, UNLESS you are in a transation.0 -
Also if you are doing any integration, I wouldn't use Dataports, instead use a codeunit. open the file and read through it and then close it in a codeunit.0
-
Mark Brummel wrote:4.06?
What version is that?
AFAK the IF .RUNMODAL THEN works in all versions, UNLESS you are in a transation.
I have the following expression - 'LoadJournal' is the dataport being called.
LoadJournal.IMPORT(TRUE);
LoadJournal.FILENAME(Configuration."Processing Path"+pFileName);
IF LoadJournal.RUNMODAL THEN
Message('');
When I try to compile the code I receive an error message saying "The expression is VOID. There must be a TRUE/FALSE expression in the IF..." ??0 -
OnAfterImportRecord() RecordCount := RecordCount + 1; OnPreDataport() RecordCount := 0; OnPostDataport() CurrFile.CLOSE; IF CONFIRM('%1 Records Imported / Would You Like To Delete The File?',TRUE,RecordCount) THEN ERASE(CurrDataport.FILENAME);
I use a count and a message0 -
Thanks. The reason I want to use the IF .RUNMODAL THEN is to provide as much of a hands-free environment as possible.
The client will have as many as 20 files in this folder to import daily. I want to be able to 1) commit & move the files that successfully imported, 2) track the files which did not and 3) provide a summary report when the process is completed so that they know what files need attention.0 -
What is you plan on how to catch the errors?
here are some posts that you might find interesting.
Talking about Writefiles & change logs, etc
http://www.mibuso.com/forum/viewtopic.php?t=17477
http://www.mibuso.com/forum/viewtopic.php?t=17967
http://www.mibuso.com/forum/viewtopic.php?t=14150
http://www.mibuso.com/forum/viewtopic.php?t=106340 -
Thanks for those articles - very helpful.
I am still confused hearing that IF. xxx.RUNMODAL THEN should work but it is giving me a failure.0 -
If you look at the C/Side help, you will see that there is no ACTION associated with the dataport runmodal, only with Form runmodal, so you can't return a status. The best thing to do is to create log table and have the dataport write a "start" message with a "fail" status, then if it completes, write a "success" status, otherwise the fail remains the same.
Dave0
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