Run XMLport in a processing report without file open dialog
c.shekhar
Member Posts: 2
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.
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 0
Comments
-
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;0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions