Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm trying to load a list of values into a variable, which I want to use next to loop through in my qliksense script.
I did this many times before, but it seems I lost my reference file and can't seem to find myself how I did it in the past.
This is my (non working) script:
------
Websites:
LOAD
WebsiteID,
Country
FROM [lib://Data/180820-website-datastructure.xlsx]
(ooxml, embedded labels, table is GAIDs);
Let vGAIDs = peek('WebsiteID',0,'Websites');
-------
It only seems to load the first field into the variable. Any idea what I'm doing wrong?
Kind regards,
Christophe
I'm understanding that you want a comma separated list of single quoted WebsiteID values to use in a For Each loop. Try:
// Build a string list in a single field, one row table
TempWebSiteListTable:
LOAD
chr(39) & Concat(WebsiteID, chr(39) & ',' & chr(39), WebsiteID) & chr(39)
as TempWebSiteList
Resident Websites
;
// Put the website list in a variable
LET vGAIDs = peek('TempWebSiteList');
// Delete the temp table
DROP TABLE TempWebSiteListTable;
-Rob
See if the below link helps:
How to assign multiple values to a single varia... | Qlik Community
Try this
Let LoopNumber=1;
For LoopNumber= 1 to NoofRows('Websites')
LET vCountry= Peek('WebsiteID', LoopNumber-1, 'Websites');
Script;
Next;
I'm understanding that you want a comma separated list of single quoted WebsiteID values to use in a For Each loop. Try:
// Build a string list in a single field, one row table
TempWebSiteListTable:
LOAD
chr(39) & Concat(WebsiteID, chr(39) & ',' & chr(39), WebsiteID) & chr(39)
as TempWebSiteList
Resident Websites
;
// Put the website list in a variable
LET vGAIDs = peek('TempWebSiteList');
// Delete the temp table
DROP TABLE TempWebSiteListTable;
-Rob