Problem reading tab delimited file (converts tabs to spaces)

andre_nandre_n Member Posts: 12
edited 2003-12-04 in Navision Attain
hi,

i'm writing a codeunit which needs to read a tab delimited file into na3.70, but navision reads the tabs as spaces :evil:. is there a way around this (or rather: what's the way around this)?

thanks.

andre

Comments

  • Torben_R.Torben_R. Member Posts: 99
    Create a variable of the type Char and set it to 9 (i.e. Char9) - as far as I remember tab has ascii code 9.

    Then test the import string for the character format(Char9) and you have found the place of the delimiter.
  • andre_nandre_n Member Posts: 12
    thanks Torben.
    navision converts the tabs (ascii 9, you're right) to space(s) (ascii 32), so the comparison will always be false. i can't check for spaces because a tab character converts to either 1, 2 or 3 space characters, and a 1 space character is legal in description fields for example.
  • nelsonnelson Member Posts: 107
    Are you using <TAB> as the FieldSeparator?
    Nelson Alberto
  • andre_nandre_n Member Posts: 12
    i am not using a dataport Nelson (i assume that's what you are referring to?), but reading the file directly from a codeunit.
  • Timo_LässerTimo_Lässer Member Posts: 481
    I think you must open the file in binary mode, so Navision doesn't convert the chars.

    Correct me if I'm wrong :roll:
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • PrebenRasmussenPrebenRasmussen Member Posts: 137
    This is very easy:
    WHILE fileIn.POS < fileIn.LEN DO BEGIN
      fileIn.READ(chrIn);
      IF chrIn = 9 THEN...
    
  • andre_nandre_n Member Posts: 12
    i'm glad it's so easy for you :twisted:
    thanks!!!
Sign In or Register to comment.