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:
Format: Variable Text
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
IF NOT ISSERVICETIER THEN BEGIN
EDIImport.FILENAME := EDIFiles.Path + EDIFiles.Name;
EDIImport.IMPORT := TRUE;
END ELSE BEGIN
EDIImportXML.FILENAME := EDIFiles.Path + EDIFiles.Name;
UNTIL EDIFiles.NEXT = 0;
[color=#FF0000]Use Following Code
FileName_lTxt := FTPSetup_gRec."XML Input File Path" + FileName2_gTxt;
IF InFile_gFil.OPEN(FileName_lTxt) THEN BEGIN
MoveFile_gBln := ICWO_gXml.GetImportStatus_gFnc;
IF EXISTS(FileName_lTxt) THEN
IF NOT MoveFile_gBln THEN BEGIN
FTPSetup_gRec."FTP Input Directory",FTPSetup_gRec."FTP User ID",FTPSetup_gRec."FTP Password",
FTPSetup_gRec."FTP Order History Path",I_gInt);