Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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

Re: Load multiple line into a variable

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;

14 Replies

Re: Load multiple line into a variable

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;

Re: Load multiple line into a variable

Hi

Try like this

= Concat(Distinct FieldName, Chr(10))

MVP
MVP

Re: Load multiple line into a variable

Create a Variable

vVariable

definition

Concat(FieldName,CHR(10))

Use as below

=$(=vVariable)

Re: Load multiple line into a variable

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

MVP
MVP

Re: Load multiple line into a variable

Chr(10) is for Line Break

Chr(13) is for Carriage Return

Not applicable

Re: Load multiple line into a variable

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');

Re: Load multiple line into a variable

Hi

In that case, remove the order by statement.

Temp:

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

Resident Table;

LET vData = Peek('Concat');

Not applicable

Re: Load multiple line into a variable

Hi,

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

Re: Load multiple line into a variable

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;

Community Browser