Qlik Community

Qlik Sense App Development

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

vasiliy_beshent
Contributor III

Load file with delimiters?

Hello everyone!

I Need to load file with delimiter comma (',')  until  i get word "Context=" and then i need to get all after "Context=..." into last field?

How to do that?

7 Replies

Re: Load file with delimiters?

I think some sample-records of this text-file would be useful.

- Marcus

vasiliy_beshent
Contributor III

Re: Load file with delimiters?

Here, please

Re: Load file with delimiters?

The first record is quite different to the following records - this meant you might need several load-steps to the header and the records and to match them in any way. Here a suggestion how the following records could be loaded:

records:

LOAD subfield([@1:n], ':', 1) as F1, subfield([@1:n], ':', 2) as F2, subfield([@1:n], ':', 3) as F3

FROM [test.txt] (fix, codepage is 1252, header is 1 lines);

In a similar way (with subfield() and/or other string-functions) would it be possible to load also the first record.

- Marcus

vasiliy_beshent
Contributor III

Re: Load file with delimiters?

So now i need to update last field with Context=

How to add data to this field?

Re: Load file with delimiters?

Based on your sample records - how should be the output-table look like?

- Marcus

vasiliy_beshent
Contributor III

Re: Load file with delimiters?

I need to get this, 2017-01-19 14_11_30.png

Last field must be "Context=words words words"

Re: Load file with delimiters?

Regarding to your sample-data would be something like this possible:

Map_Extra:

mapping load filebasename() as FilebaseName, concat([@1:n], ' ') as Value

From [test.txt] (fix, codepage is 1252, header is 1 lines);

Data:

first 1 LOAD

     @1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13,

     @14 & applymap('Map_Extra', filebasename(), '#NV') as @14

FROM [test.txt] (txt, codepage is 1252, no labels, delimiter is ',');

- Marcus

Community Browser