0

I have a .dat file which is delimited by a pipe (|). Now my columns can have | in the data. I am facing issues while reading this file and loading it column by column.

DML used:

record
string("|") col1,
string("|") col2,
string("|") col3,
string("|") col4,
end

Source value:

"Col1"|"col2"|"col3"|"col4"
"units of the price | currency used" | "ABC" | "20210831" | ""

So col1 = units of the price | currency used, col2 = ABC , col3 = 20210831 , col4 = null

As per my dml it is breaking first col in 2 and hence failing. How can I read the file and load it with the correct values.

  • Perhaps you could define the delimiter as string(\"|"\") i.e. use "|" as the delimiter instead of only | - you will end up with an extra " at the beginning and end of the record, but that is easily removed later – user230910 Nov 02 '21 at 23:16

2 Answers2

0

You could define the delimiter as string(\"|"\") i.e. use "|" as the delimiter instead of only | - you will end up with an extra " at the beginning and end of the record, but that is easily removed later

user230910
  • 2,353
  • 2
  • 28
  • 50
-1

Please use "READ SEPARATED VALUES" component to achieve this.

samir
  • 1