Run XMLport in a processing report without file open dialog

c.shekharc.shekhar Member Posts: 2
edited 2013-06-26 in NAV Three Tier
Hi

I have an old mod (Navision 3.7) which we are upgrading to NAV 2009 R2 RTC. I want to run XMLport (dataport was used in Navision 3.7) in a processing report without file open dialog box.

The files which are required to be processed are csv files and are sitting in a folder on network. File paths are stored in UNC convention. NAV Server and RTC User both have full permission to the folder and files. In RTC, user runs a processing report. The Processing report locates the folder and reads the file(s) in a repeat until loop. For each file located in the repeat until loop, Name of the file is parsed to decide if the data in file needs to be loaded in NAV table, and uses an XMLPort (it was using a dataport in older version). File name passed to XMLpoprt by setting FILENAME property of XMLport.

In classic when the report (which uses dataport) is run, no file open dialog box appears. Everything works fine

The problem is in RTC.

In RTC when the report is run, file open dialog box appears, with Open and cancel button. Correct folder is selected and I can see the correct file in the dialog box. Selecting Open runs the XMLport properly and data is also loaded correctly. The problem is that we need to run the XMLport in silent mode (without any file open dialog boxes), without user pressing open buttons all the time. As file names are passed on by the processing report to XMLport, is there any way to run the XMLport without showing File Open Dialog Box, instead of re-writing the file import funnction?


XMLport properties set:
Direction: Import
Format: Variable Text
UseReqForm: No

Code snippet below. EDIImport is a dataport where as EDIImportXML is the XMLport.
EDIFiles.SETRANGE(Path, EDISetup."EDI File Location");
EDIFiles.SETRANGE("Is a file", TRUE);
IF EDIFiles.FIND('-') THEN REPEAT
...

  IF NOT ISSERVICETIER THEN
    CLEAR(EDIImport)
  ELSE
    CLEAR(EDIImportXML);
...
            IF NOT ISSERVICETIER THEN BEGIN
              EDIImport.FILENAME := EDIFiles.Path + EDIFiles.Name;
              EDIImport.IMPORT := TRUE;
              EDIImport.RUNMODAL;
              CLEAR(EDIImport);
            END ELSE BEGIN
              EDIImportXML.FILENAME := EDIFiles.Path + EDIFiles.Name;
              EDIImportXML.RUN;
              CLEAR(EDIImportXML);
            END;
...

UNTIL EDIFiles.NEXT = 0;
Chandra :-k

Comments

  • nilesh4381nilesh4381 Member Posts: 33
    c.shekhar wrote:
    Hi

    I have an old mod (Navision 3.7) which we are upgrading to NAV 2009 R2 RTC. I want to run XMLport (dataport was used in Navision 3.7) in a processing report without file open dialog box.

    The files which are required to be processed are csv files and are sitting in a folder on network. File paths are stored in UNC convention. NAV Server and RTC User both have full permission to the folder and files. In RTC, user runs a processing report. The Processing report locates the folder and reads the file(s) in a repeat until loop. For each file located in the repeat until loop, Name of the file is parsed to decide if the data in file needs to be loaded in NAV table, and uses an XMLPort (it was using a dataport in older version). File name passed to XMLpoprt by setting FILENAME property of XMLport.

    In classic when the report (which uses dataport) is run, no file open dialog box appears. Everything works fine

    The problem is in RTC.

    In RTC when the report is run, file open dialog box appears, with Open and cancel button. Correct folder is selected and I can see the correct file in the dialog box. Selecting Open runs the XMLport properly and data is also loaded correctly. The problem is that we need to run the XMLport in silent mode (without any file open dialog boxes), without user pressing open buttons all the time. As file names are passed on by the processing report to XMLport, is there any way to run the XMLport without showing File Open Dialog Box, instead of re-writing the file import funnction?


    XMLport properties set:
    Direction: Import
    Format: Variable Text
    UseReqForm: No

    Code snippet below. EDIImport is a dataport where as EDIImportXML is the XMLport.
    EDIFiles.SETRANGE(Path, EDISetup."EDI File Location");
    EDIFiles.SETRANGE("Is a file", TRUE);
    IF EDIFiles.FIND('-') THEN REPEAT
    ...
    
      IF NOT ISSERVICETIER THEN
        CLEAR(EDIImport)
      ELSE
        CLEAR(EDIImportXML);
    ...
                IF NOT ISSERVICETIER THEN BEGIN
                  EDIImport.FILENAME := EDIFiles.Path + EDIFiles.Name;
                  EDIImport.IMPORT := TRUE;
                  EDIImport.RUNMODAL;
                  CLEAR(EDIImport);
                END ELSE BEGIN
                  EDIImportXML.FILENAME := EDIFiles.Path + EDIFiles.Name;
                  EDIImportXML.RUN;
                  CLEAR(EDIImportXML);
                END;
    ...
    
    UNTIL EDIFiles.NEXT = 0;
    
    Chandra :-k

    Use Following Code:
    CLEAR(InFile_gFil);
    CLEAR(FileName_lTxt);
    FileName_lTxt := FTPSetup_gRec."XML Input File Path" + FileName2_gTxt;
    IF InFile_gFil.OPEN(FileName_lTxt) THEN BEGIN
    InFile_gFil.CREATEINSTREAM(InputStream_gIsm);
    CLEAR(ICWO_gXml);
    ICWO_gXml.SETSOURCE(InputStream_gIsm);
    ICWO_gXml.SetFileName_gFnc(FileName2_gTxt);
    ICWO_gXml.IMPORT;
    MoveFile_gBln := ICWO_gXml.GetImportStatus_gFnc;
    InFile_gFil.CLOSE;
    IF EXISTS(FileName_lTxt) THEN
    ERASE(FileName_lTxt);
    IF NOT MoveFile_gBln THEN BEGIN
    DownloadFTPFile_gAut.MoveOrders(
    FTPSetup_gRec."FTP Input Directory",FTPSetup_gRec."FTP User ID",FTPSetup_gRec."FTP Password",
    FTPSetup_gRec."FTP Order History Path",I_gInt);
    END;
    END;
    Regards,
    Nilesh Gajjar

    Nav Technical Consultant
    http://www.intech-systems.com
Sign In or Register to comment.