Run dataport from form button

wesleyswesleys Member Posts: 30
edited 2004-04-15 in Navision Attain
I have a dataport that I want to run dynamically from a form. The form knows the file name I want to import. I do not want the dataport request form to pop up where I have to enter the filename.

The dataport properties I think are significant are as follows:
Import: <Yes>
FileName: C:\default.txt (I read that leaving it blank will cause the request form to appear)
UseReqForm: No

All other properties are default values.

The OnPush event for the button looks like this:
ImportFile.IMPORT(TRUE);
ImportFile.FILENAME(vFileName);
ImportFile.RUN;

This brings up the request form with a blank filename. I've added message commands to show that vFileName does in fact have a value before the the ImportFile.FILENAME(vFileName); command. I've also set message commands to show me that the value of ImportFile.FILENAME is what I want after this command is run.

Alternately I have used: DATAPORT.RUN(DATAPORT::"The dataport", FALSE); This successfully avoids the request form, however the correct filename is not set so I get an error.

How do I make this all come together so that it works right?

Comments

  • Erik_EErik_E Member Posts: 17
    simply set the import property on the dataport to : "yes" and then run the dataport on the push trigger if u wanna work with a commandbutton or runobject and then dataport # dataport when u wanna run the port from a menubutton.
Sign In or Register to comment.