Using xml ports to create/import CSV files

ccbryan63ccbryan63 Member Posts: 115
Hi... I'm trying to use this code that I swiped from Maris2000 to run XML Port 5050 for testing purposes
IF ISCLEAR(FileSystem) THEN
  CREATE(FileSystem);

FilePath := 'C:\';

IF NOT FileSystem.FolderExists(FilePath) THEN
  FileSystem.CreateFolder(FilePath);

IF EXISTS(FilePath + 'PostCode.csv')  THEN
  ERASE(FilePath + 'PostCode.csv');

TestFile.CREATE(FilePath + 'PostCode.csv');
TestFile.CREATEOUTSTREAM(TestStream);

XMLPORT.EXPORT(5050, TestStream);
TestFile.CLOSE;

But I gettting errors on the variables. How do 'Filesystem' and 'TestFile' (and 'Teststream'?) need to be inititalized?

Thanks,
Chandler

Comments

  • ara3nara3n Member Posts: 9,256
    what is the error that you are getting?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • SavatageSavatage Member Posts: 7,142
    But I gettting errors on the variables. How do 'Filesystem' and 'TestFile' (and 'Teststream'?) need to be inititalized?

    Can I assume he's asking how are they Defined in the globals

    FileSystem - Type System
    TestFile - Type File
    TestStream - Type Stream

    or something like that.. am I correct?
  • ccbryan63ccbryan63 Member Posts: 115
    Thanks for the responses... Yes, I was looking for how to define in globals. However, when I set them up as Savatage suggested:

    FileSystem - Type System
    TestFile - Type File
    TestStream - Type OutStream ('Stream' is not listed as a type)

    I get a compile error "Type conversion not possible because 1 of the operators contains an invalid type. Automation := System"

    ?

    Chandler
  • SavatageSavatage Member Posts: 7,142
    Yeah, I don't know what he used - it's probably an automation - I just guessed on the filesystem one.

    I haven't looked at what the code does but maybe it's WshShell
  • mihail_kolevmihail_kolev Member Posts: 379
    CREATE(FileSystem,FALSE,ISSERVICETIER);
    -Mihail- [MCTS]
Sign In or Register to comment.