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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load carriage return-ed fields as separate values?

I have a field (ITEMS) in the database I'm using in which the data entry team uses carriage returns for additional items:

ORDER_NUMBERITEMS
96496498

ball

umbrella

pool cue

frog

94165498

zydeco

ocarina

guitar

Is there any way to dice up ITEMS in a different field like ITEMS_2, so each item is a different value/row, but still associated to the ORDER_NUMBER? Like this:

ORDER_NUMBERITEMS_2
96496498ball
umbrella
pool cue
frog
94165498zydeco
ocarina
guitar
1 Solution

Accepted Solutions
Not applicable
Author

This is the code that worked for my particular situation:

 

SubField

(ITEMS, '
', )
as [SUB_ITEMS]

;

- instead of using a character code of 0A which wasn't working for the parsing, I just used pressed "Enter".

View solution in original post

2 Replies
swuehl
MVP
MVP

You can probably use Subfield() function for this, like

LOAD ORDER_NUMBER,

     ITEMS,

     SubField(ITEMS, chr(13)) as SUBITEM;

//Just a demo string

LOAD 'String1'&chr(13)&'String2'&chr(13)&'String3' as ITEMS,

     1234 as ORDER_NUMBER

AutoGenerate 1;

You'll need to find the correct ascii code for your separator.

Not applicable
Author

This is the code that worked for my particular situation:

 

SubField

(ITEMS, '
', )
as [SUB_ITEMS]

;

- instead of using a character code of 0A which wasn't working for the parsing, I just used pressed "Enter".