Specifying filename in a dataport WIHTOUT RequestForm

mel_sadekmel_sadek Member Posts: 23
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

  • BgestelBgestel Member Posts: 136
    have you tried testing the dataport , from the object designer, with th requestform set to true, i'm thinking it might just be exporting nothing
    **********************
    ** SI ** Bert Van Gestel **
    **********************
  • mel_sadekmel_sadek Member Posts: 23
    Thanks for your reply Bgestel.

    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. :D

    Thanks for your concern and appreciation.

    Mods, consider this topic resolved.
  • BeliasBelias Member Posts: 2,998
    why don't set filename property and import property in dataport properties?
    also set: UseReqForm=no

    :shock:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.