Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
christophebrock1
Contributor II
Contributor II

Create a list from a table

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

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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

http://masterssummit.com

http://qlikviewcookbook.com

http://www.easyqlik.com

View solution in original post

4 Replies
trdandamudi
Master II
Master II

vamsee
Specialist
Specialist

Try this

Let LoopNumber=1;

For LoopNumber= 1 to NoofRows('Websites')

LET vCountry= Peek('WebsiteID', LoopNumber-1,  'Websites');

Script;

Next;

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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

http://masterssummit.com

http://qlikviewcookbook.com

http://www.easyqlik.com

twon23
Contributor
Contributor

Great solution, thank you!