Importing file with | as a field seperator

tabularasatabularasa Member Posts: 22
edited 2010-12-07 in NAV Three Tier
Hello guys.

I'm using xml port to import file that has | as a seperator and obviously without success. Anyone that know's about a workaround other than changing the file. I can import this if I change the file to a Tab delimited file.

Comments

  • ara3nara3n Member Posts: 9,256
    Are you running it on RTC or classic? XMLPort can be used for other type of files but only on RTC not in classic. In classic it can only be used for xml files.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • tabularasatabularasa Member Posts: 22
    I'm running the xml port from rtc.
  • tabularasatabularasa Member Posts: 22
    ara3n wrote:
    Are you running it on RTC or classic? XMLPort can be used for other type of files but only on RTC not in classic. In classic it can only be used for xml files.

    Are you shure about this. Isn't it possible to run a xml port through code units called from f.eks. application server that would import or export flexible text file.
  • ara3nara3n Member Posts: 9,256
    I don't know what f.eks is but even on NAS it only will run xml file types.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • davmac1davmac1 Member Posts: 1,283
    I have a question for Microsoft - I hope one of their people is monitoring this.
    If dataports are going away in version 7, then how will we handle text file imports using Navision Application Server (NAS) if NAS does not support using xmlports for text file imports?
    Does Microsoft plan to add this capability or will NAS be replaced by another 3 tier client for handling background batch processing?
    Or is this "Whoops - this never occurred to us?"
  • tabularasatabularasa Member Posts: 22
    But what about using | as a field seperator any idea how that can be done.
  • ara3nara3n Member Posts: 9,256
    davmac1 wrote:
    I have a question for Microsoft - I hope one of their people is monitoring this.
    If dataports are going away in version 7, then how will we handle text file imports using Navision Application Server (NAS) if NAS does not support using xmlports for text file imports?
    Does Microsoft plan to add this capability or will NAS be replaced by another 3 tier client for handling background batch processing?
    Or is this "Whoops - this never occurred to us?"

    You connot run dataport on NAS.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ccbryan63ccbryan63 Member Posts: 115
    As I have just found, you can import a flat file with XMLPort in RTC... but only, apparently, in RTC. That is, running my XMLPort in 2009 Classic gets a 'format error, column 1 line 1', but it works properly in RTC.

    Heres how it's working for me: I'm importing this flat file into Payroll Journal Lines:

    "PAYROLL","10000","11",11/30/2010,"Payment","Regular Hours",11/30/2010,"WEEKNEW","DRIVERS","25.49"....
    "PAYROLL","20000","139",11/30/2010,"Payment","Regular Hours",11/30/2010,"WEEKNEW","PRODUCTIN","29.011"....
    "PAYROLL","30000","14",11/30/2010,"Payment","Regular Hours",11/30/2010,"WEEKNEW","SUPERV","30.18"....
    "PAYROLL","40000","170",11/30/2010,"Payment","Regular Hours",11/30/2010,"WEEKNEW","DRIVERS","40.00"....
    "PAYROLL","50000","170",11/30/2010,"Payment","Overtime Hours",11/30/2010,"WEEKNEW","DRIVERS","01.37"....
    "PAYROLL","60000","18",11/30/2010,"Payment","Regular Hours",11/30/2010,"WEEKNEW","MECH","36.18"....

    Here are the corresponding lines in my dataport grid:
    Node Name	                Node Type	Source Type      Data Source
    Root	                     Element	  Text	          <Root>
       PayrollJournalLine	    Element	  Table	         <Payroll Journal Line>(Payroll Journal Line)
          JournalTemplateName   Element	  Field	         <Payroll Journal Line>::Journal Template Name
          LineNo	             Element	  Field   	      <Payroll Journal Line>::Line No.
          EmployeeNo	         Element	  Field	         <Payroll Journal Line>::Employee No.
          PostingDate	        Element	  Field	         <Payroll Journal Line>::Posting Date
          DocumentType	       Element	  Field	         <Payroll Journal Line>::Document Type
          Description	        Element	  Field	         <Payroll Journal Line>::Description
          PayPeriodEndDate      Element	  Field	         <Payroll Journal Line>::Pay Period End Date
          PayCycleCode	       Element	  Field	         <Payroll Journal Line>::Pay Cycle Code]
          PayrollPostingGroup   Element	  Field	         <Payroll Journal Line>::Payroll Posting Group
          HoursMinutes	       Element	  Field	         <Payroll Journal Line>::Hours.Minutes
    ....
    

    No global or local variables are needed. In the XMLPort properties set "Format" to "Variable Text". I have "field separator" as <,>; for pipe-separated I assume you'd substitute <|>.

    I'm still hoping for an answer here on how to work with these variables in code triggers, but this ought to get you started. Remember, run it from the RTC. You can use a codeunit or call it directly from a page action, setting the RunObject propery of the action to the name of your XMLPort.

    Good luck...
  • deV.chdeV.ch Member Posts: 543
    No global or local variables are needed. In the XMLPort properties set "Format" to "Variable Text". I have "field separator" as <,>; for pipe-separated I assume you'd substitute <|>.
    That's the way to go, except from the <|> as a value for the "field seperator" Property. If you change a Property value to something other then std. you never use the < and > signs (exception is the <none> statement). So it's: "Field Seperator" : |
  • ara3nara3n Member Posts: 9,256
    As I mentioned before xmlport in classic only run xml files.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.