Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
deerhunter
Contributor

Dealing with CRLF

Were trying to read in a file that looks something like this:

FIELD1               FIELD2                    FIELD3

AAA               A1 A2 A3 A4          13% 11% 9% 6%

BBB               B1 B2 B3 B4          2% 22% 44% 5%

CCC               C1 C2 C3 C4         7% 33% 44% 32%

for each row, FIELD2 & FIELD3 are a single field with multiple entries separated by CRLF's, each are consumed as a single row as shown above, there are 3 rows in this example.

Looking to visualize with a table and be able to export to excel the data so that it looks similar to below:

FIELD1,FIELD2,FIELD3

AAA A1 13%

AAA A2 11%

AAA A3 9%

and so on to the EOF....

Any ideas?

Thanks in advance

Message was edited by: buck master

1 Solution

Accepted Solutions
deerhunter
Contributor

Re: Dealing with CRLF

did not work, can you update the orig included qvf?

maybe i missed something

8 Replies
MVP & Luminary
MVP & Luminary

Re: Dealing with CRLF

If you could directly read the data from an excel or a database into the above mentioned fields you could split them per subfield() which worked without a third-parameter within a load like a loop or you could use a while-loop with iterno() as third-parameter for subfield. Therefore try something like:

load

     FIELD1,

     subfield(FIELD2, chr(13) & chr(10), iterno()) as FIELD2

     subfield(FIELD3, chr(13) & chr(10), iterno()) as FIELD3

from YourSource while iterno() <= substringcount(FIELD2, chr(13) & chr(10)) + 1;

- Marcus

deerhunter
Contributor

Re: Dealing with CRLF

did not work, can you update the orig included qvf?

maybe i missed something

MVP & Luminary
MVP & Luminary

Re: Dealing with CRLF

What didn't work? Any error-messages? Results are different as expected - if yes how does they look like? What is the source of these data?

Currently I haven't Sense available and couldn't therefore not take a look into it.

- Marcus

deerhunter
Contributor

Re: Dealing with CRLF

I included a test app in the original post

MVP & Luminary
MVP & Luminary

Re: Dealing with CRLF

Your app contained no data. Did you really try my suggestion?

deerhunter
Contributor

Re: Dealing with CRLF

Very sorry i just added the data to the post.

Thanks

MVP & Luminary
MVP & Luminary

Re: Dealing with CRLF

The delimiter within the fields isn't CRLF else only LF but the logic itself worked - see it within the attachment.

- Marcus

deerhunter
Contributor

Re: Dealing with CRLF

Thanks that's perfect you have been a big help !