From: "Gary Chick" <Gary on
Hi ALL,

I have an question about open files in Navision. I have a Codeunit which
used to import XMLport.

Code:
TestFile.OPEN('C:\Output\PO1.xml');
TestFile.CREATEINSTREAM(TestStream);
XMLPORT.IMPORT(50003,TestStream);

Besides PO1.xml, there are also other xml eg PO2.xml, PO3.xml, etc in the
Output folder. And what I want to do is to import all *.xml files in the
Output folder to Navision, but I don't know exactly how many xml files will
be in the folder and the file names of each files. I want to make this
codeunit to be able to open and read all the xml file in the Output folder so
that I can put this Codeunit in the Job Scheduler and let it run regularly.

Does anyone have some ideas?
From: Helge on
Hi,

define a Varialble as Record, Subtype "File".

FileVar.SETRANGE(Path,'c:\folder\');
FileVar.SETRANGE("Is a file",TRUE);
FileVar.SETFILTER(Name,'*.xml');
IF FileVar.FIND('-') THEN REPEAT
TestFile.OPEN(FileVar.Path + FileVar.Name);
TestFile.CREATEINSTREAM(TestStream);
XMLPORT.IMPORT(50003,TestStream);
UNTIL FileVar.Next=0;

Helge

"Gary Chick" wrote:

> Hi ALL,
>
> I have an question about open files in Navision. I have a Codeunit which
> used to import XMLport.
>
> Code:
> TestFile.OPEN('C:\Output\PO1.xml');
> TestFile.CREATEINSTREAM(TestStream);
> XMLPORT.IMPORT(50003,TestStream);
>
> Besides PO1.xml, there are also other xml eg PO2.xml, PO3.xml, etc in the
> Output folder. And what I want to do is to import all *.xml files in the
> Output folder to Navision, but I don't know exactly how many xml files will
> be in the folder and the file names of each files. I want to make this
> codeunit to be able to open and read all the xml file in the Output folder so
> that I can put this Codeunit in the Job Scheduler and let it run regularly.
>
> Does anyone have some ideas?
 | 
Pages: 1
Prev: Date not valid
Next: navision .fbk -->MsSQL