How to import/export csv files in the RTC

maris2000maris2000 Member Posts: 71
edited 2010-07-08 in NAV Three Tier
Can anyone tell me how to import/export csv files in the RTC.
I know that I have to use XMLport, and I have tried but it's not working.
Can you please explain how to do this properly, or give an example.

Answers

  • kinekine Member Posts: 12,562
    What does it mean "and I have tried but it's not working"? Some errors? Or you do not know how to run the XMLPort? Is the file you want to import on the service tier machine?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • maris2000maris2000 Member Posts: 71
    ups, sorry. I don't know what I was thinking yesterday.

    Well, first of all I am just trying with a very simple exsample for exercise.

    I have created XMLport based on "Post Code" table, and I need I to work both ways(import/export).

    The XMLport should export/import data as csv file.

    I have changed the Format property to "Variable Text" and when I run the XMLport data is exported in XML format.

    I don't know how to make the XMLport to act as dataport.

    Do I have to change some other properties or add some code to XMLport?

    I was searching the web for an example or an explanation on this, but could find anything.

    Would you be kind enough to explain me what I am doing wrong or maybe give an example.
  • kinekine Member Posts: 12,562
    The XMLPort itself have no request form. You need to call it through XMLPORT.IMPORT or XMLPORT.EXPORT where you are passing the InStream or OutStream to the file you want to use.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • maris2000maris2000 Member Posts: 71
    I did this but the data in csv file is in xml format. I thought that I would get csv file.
    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(50000, TestStream);
    TestFile.CLOSE;
    
  • kinekine Member Posts: 12,562
    1) Check again that the property Format of the xmlport is set correctly
    2) Are you trying it from CC or RTC?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • maris2000maris2000 Member Posts: 71
    By the way I am testing xmlport on classic client just to see if it works as supposed to(exporting csv file), but it is not.
    and format property is set to variable text.
  • kinekine Member Posts: 12,562
    I am afraid that the XMLPort as Dataport behave only when running on Service tier, it means when it is started from RTC. For CC you still need to use dataports (but this is just my expectation right now).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • maris2000maris2000 Member Posts: 71
    So I have to try from RTC now.
    I thougt that if format property is set to variable text, XMLport would act as dataport on CC too. :oops:
  • maris2000maris2000 Member Posts: 71
    Kine you have right.
    thank you:)
    It works from rtc.
    I don't know why in the world I didn test from CC first. this was very stypid of me.
    tanx again, tankt you all.
    I love Mibuso :P
  • kinekine Member Posts: 12,562
    You are welcome. 8)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    maris2000 wrote:
    I love Mibuso :P
    I love it when you love mibuso ;-)
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • dipakpatel2505dipakpatel2505 Member Posts: 169
    Hi all,
    I am facing the same problem which is as follows:
    I want to import data in RTC using XML Port. For that I want to use either CSV file or Excel File.Using CSV File I am not able to import data in RTC.
    How can I import Data in RTC from Excel or CSV file ? (If Possible then Please Provide me example)
    Is there any other option to Import data in RTC ?
    Please Guide me.

    With Best Regards
    Dipak Patel
  • ccbryan63ccbryan63 Member Posts: 115
    hi, trying to use Maris' code above but NAV doesn't recognize "filesystem." How does that need to be initialized? It appears to want an automation object...

    Thanks,
    Chandler
Sign In or Register to comment.