Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

jheasley
Contributor

Loop with Variables

Good Afternoon,

     I am trying to pull in a limited set of alert information from a set of ATOM feeds.  i have a web based XML that i can get the list of feeds from, and i am trying to construct a loop that will extract all of the atom feeds into one table. The loop never changes feed addresses as designed with the variable.  i have the full script below (all sources are web based, no qlik files needed).

FEEDS:

LOAD

    title as FEEDTitle,

    countrycode as FEEDCtry,

    AutoNumber(countrycode)as CTID,

    capAlertFeed,

    "capAlertFeed/xml:lang" as FEEDLang,

    "link/href" as FEEDLink

FROM [http://meteoalarm.eu/ATOM/root.xml]

(XmlSimple, table is [feed/entry],embedded labels);

let vmaxID = 36;

let vCurrentID = 1;

Do while vCurrentID <= vmaxID

CurrentFeed:

load

capAlertFeed as CurrentFeed1

resident FEEDS

where (CTID = '$(CurrentID)');

let vCurrentFeed = peek('CurrentFeed1');

//loading starts here:

Load

[cap:areaDesc],

[cap:certainty],

[cap:effective],

[cap:event],

[cap:expires],

[cap:geocode],

[cap:msgType],

[capSmiley Surprisednset],

[cap:sent],

[cap:severity],

[cap:status],

[cap:urgency],

[id],

[link],

[published],

[updated]

From

['$(vCurrentFeed)'](xml);

let vCurrentID2 = 1+vCurrentID;

Let vCurrentID = vCurrentID2;

Drop Table CurrentFeed;

Loop;