Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load multiple line into a variable

Hi Experts,

I need to load a multiple line from text and store it into a single variable, can someone please help me on the same?

Below is the scenario:

I have a text file in the system with the name sample.txt with below data.

Sample.txt

ABCDEF

GEFG

JSDFR

Now i need to load the file in the qlikview and store all 3 line in a single varaible

vData = 'ABCDEF

             GEFG

             JSDFR'

Please guide me on how to achieve this?

1 Solution

Accepted Solutions
sunny_talwar

Try this:


LET vData = Concat(FieldName, Chr(13))

Table:

LOAD * Inline [

FieldName

ABCDEF

GEFG

JSDFR

];

Temp:

LOAD Concat(FieldName, Chr(13)) as Concat

Resident Table;

LET vData = Peek('Concat');

DROP Table Temp;

View solution in original post

14 Replies
sunny_talwar

Try this:


LET vData = Concat(FieldName, Chr(13))

Table:

LOAD * Inline [

FieldName

ABCDEF

GEFG

JSDFR

];

Temp:

LOAD Concat(FieldName, Chr(13)) as Concat

Resident Table;

LET vData = Peek('Concat');

DROP Table Temp;

MayilVahanan

Hi

Try like this

= Concat(Distinct FieldName, Chr(10))

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
MK_QSL
MVP
MVP

Create a Variable

vVariable

definition

Concat(FieldName,CHR(10))

Use as below

=$(=vVariable)

sunny_talwar

Manish what is Chr(10)? Is it the same as Chr(13)???

MK_QSL
MVP
MVP

Chr(10) is for Line Break

Chr(13) is for Carriage Return

Not applicable
Author

Thank you All for the quick response..It helped me a lot.

But now i have one more doubt on the same.

I amusing the below script:

But what happen here is in Temp table the Concat feild get sorted automatically i want them to be in the same format as in my data. Can you please help me?

Table:

LOAD @1 as FieldName,

AutoNumber(@1) as FieldNo

FROM

(txt, codepage is 1252, no labels, delimiter is ',fdgfdfd', msq);

Temp:

LOAD Concat(FieldName, Chr(13)) as Concat

Resident Table order by FieldNo;

LET vData = Peek('Concat');

MayilVahanan

Hi

In that case, remove the order by statement.

Temp:

LOAD Concat(FieldName, Chr(13)) as Concat

Resident Table;

LET vData = Peek('Concat');

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi,

It did not helped my friend, with or without order by

sunny_talwar

Try this:

Table:

LOAD *,

  RowNo() as Sort

Inline [

FieldName

ABCDEF

JSDFR

GEFG

];

Temp:

LOAD Concat(FieldName, Chr(13), Sort) as Concat

Resident Table;

LET vData = Peek('Concat');

DROP Table Temp;