Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Catch up on the newest Qlik features and improvements: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

CSV files - other options for delimiters (not ";" or ",")

Hello !

I'd like to load some CSV files that use non trivial characters as field delimiters.

Maybe CHR(186) from ASCII table or CHR(179).

This is because the CSV file is generated from a mainframe and sometimes, the field values may contain ":" or ",". And the string fields are not embeded on quotes, nor I want them to be.

On the attached example we have a sample of this mainframe generated CSV file and an application supposed to load it.

Thanks in advance for your support !

Labels (1)
3 Replies
m_woolf
Master II
Master II

Try the attached qvw.

Not applicable
Author

Try using loading all the line from the file, and then get the delimited fields by means of the SubField() function:

 

LOAD

          SubField(Campo, chr(179), 1) AS EMPRES_CBHPR,

          SubField(Campo, chr(179), 2) AS NUMHPR_CBHPR,

          SubField(Campo, chr(179), 3) AS DESHPR_CBHPR,

          SubField(Campo, chr(179), 4) AS e;

LOAD @1:n as Campo

FROM

C:\Temp\KIT201P\TEST201P.CSV

(fix, codepage is 1252, embedded labels);

Hope this helps,

   JG

Not applicable
Author

Hi !

Loading separated fields "substringing" each one of them is a way to solve the issue.

However, there are many different tables (layouts). I'd have to set up the layout of each one of them.

Also, when I insert another field in between other existing fields of a csv the script needs to be re programmed.

The solution works but on a daily basis it's not practical.

Let keep on listening to other ideas....

One thing I discovered is that it looks like the delimiter might be anything BELOW chr(128). Above that it does not work...