Options

Run status of Dataport

spencer_graham@hotmail.comspencer_graham@hotmail.com Member Posts: 11
edited 2002-08-21 in Navision Financials
Hello All,

I have a code unit that starts a dataport,

ObjDataport.FILENAME:=strFileName;
ObjDataport.IMPORT:=TRUE;
ObjDataport.RUNMODAL;
CLEAR(ObjDataport);

How do I know if the dataport has run with out errors

I know I can tricks about with deleting the file in the onPostDataport trigga.

But I would like to keep all this code in my code unit.

Regards Graham

Comments

  • Options
    mvmv Member Posts: 4
    You should be able to solve you problem by setting a success flag in the OnPostDataport trigger, and create a new function to return this flag, like:

    OnPostDataport()
    RunSucces := TRUE;

    GetRunSuccess() : Boolean
    EXIT(RunSuccess);
  • Options
    Thx for replying to my post.

    This was a new way of thinking... Even throw the program has ended you can still access its functions.

    so now my code looks like this...

    ObjDataport.FILENAME:=strFileName;
    ObjDataport.IMPORT:=TRUE;
    ObjDataport.RUNMODAL;

    // If Dataport updated sucessfully move ASCII text file to Archive directory.
    IF ObjDataport.GetRunSuccess = TRUE THEN
    --CopyFile(strFileName,FormatFileName(strArchivePath,RecFiles.Name)) // OK Archive
    ELSE
    --CopyFile(strFileName,FormatFileName(strErrorsPath,RecFiles.Name)); // Error

    CLEAR(ObjDataport);

    Thx once again
    Graham
Sign In or Register to comment.