Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Become an analytics expert with Qlik's new 15 week course: Applied Data Analytics using Qlik Sense. READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Sokkorn
Master
Master

How to create variable to get all field value from load?

Hi All,

I have load script as below:

[tmpDate]:
LOAD * INLINE
[DateField,
'01-06-2011',
'02-06-2011',
'03-06-2011'];

What I want is var1='01-06-2011','02-06-2011','03-06-2011'

How can I do this?

Please help to add script.

Thanks in advanced!

Best Regards,

Sokkorn Cheav

1 Solution

Accepted Solutions
nagaiank
Specialist III
Specialist III

You may try the following script also to get the values between single quotes.

[tmpDate]:

LOAD Chr(39) & DateField & Chr(39) as DateField,'x' as Grp;

LOAD * INLINE

[DateField,

'01-06-2011',

'02-06-2011',

'03-06-2011'];

Temp:

LOAD Grp, Concat(DateField,',') as var Resident tmpDate Group By Grp;

LET var = Peek('var',0,Temp);

DROP Table Temp;

Hope this helps.

View solution in original post

5 Replies
Not applicable

=Concat(DateField,',')

Hope this helps

Sokkorn
Master
Master
Author

Hi Dihuibao,

Thanks for your reply. After load data with your script, it require Group By. Can you add more detail on this.

Note: What I want is var1='01-06-2011','02-06-2011','03-06-2011'

Many thanks

kaushiknsolanki
Luminary Alumni
Luminary Alumni

Hi

   Here is an example.

   Try below code - Replace field name with your data fields.

  

Directory;

LOAD [Customer Name]

FROM

[..\My Documents\Downloads\TestData.xls]

(biff, embedded labels, table is Sheet1$);

let count  = FieldValueCount('Customer Name');

set var = '1';

for i=1 to $(count)

if '$(var)' = 1 then

   let var = FieldValue('Customer Name',$(i));

ELSE

   let var = '$(var)' & ','& FieldValue('Customer Name',$(i)); 

end if

Next  

Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".
nagaiank
Specialist III
Specialist III

You may try the following script also to get the values between single quotes.

[tmpDate]:

LOAD Chr(39) & DateField & Chr(39) as DateField,'x' as Grp;

LOAD * INLINE

[DateField,

'01-06-2011',

'02-06-2011',

'03-06-2011'];

Temp:

LOAD Grp, Concat(DateField,',') as var Resident tmpDate Group By Grp;

LET var = Peek('var',0,Temp);

DROP Table Temp;

Hope this helps.

View solution in original post

Sokkorn
Master
Master
Author

Thanks Krishnamoorthy.