Hi,
I'm having a devil of a time trying to run a simple dataport that exports data from a Navision table to a specific file on the system. I am NOT using the RequestForm, because this dataport has to be an automated process that requires no user interaction.
I've searched all of the relevant topics on the forum, but I haven't found anything that works.
Here is the code that I use to "try" to make this a reality. I use a codeunit to first create the file and then run the dataport:
MyFile.WRITEMODE(TRUE);
MyFile.TEXTMODE(TRUE);
MyFile.CREATE('C:\transactions.csv');
MyFile.CLOSE;
MyDataport.IMPORT(FALSE) ;
MyDataport.FILENAME:='C:\transactions.csv';
MyDataport.RUN;
As you can see, the "transactions.csv" file is the name of the file I want to export to. I then run the dataport right after. Note that my RequestForm property is set to "No" already. When I run this codeunit, the file is created, but the dataport DOES NOT populate it. I've spent a good two hours on it, but no luck though. ](*,)
Thanks for your help in advance.
Comments
** SI ** Bert Van Gestel **
**********************
No it wasn't the RequestForm property that was causing the problem. After a lot more digging I found that the Import property on the Dataport MUST be set to FALSE (either in design mode or AFTER completing the OnPreDataport trigger). I was setting it at the OnInitDataport trigger, which had no effect, hence my problem.
Now problem solved.
Thanks for your concern and appreciation.
Mods, consider this topic resolved.
also set: UseReqForm=no
:shock:
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog