Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Sokkorn
Honored Contributor

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
Valued Contributor III

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

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.

5 Replies
Not applicable

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

=Concat(DateField,',')

Hope this helps

Sokkorn
Honored Contributor

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

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

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

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

nagaiank
Valued Contributor III

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

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.

Sokkorn
Honored Contributor

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

Thanks Krishnamoorthy.