- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Tags:
- qlikview_scripting
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
=Concat(DateField,',')
Hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Krishnamoorthy.