Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Use reference in a different table in a load statement

Hi,

I have not used QV for a while and need some help. Do not know if it's even possible to solve my problem.

I'm trying to build my own portfolio application and would like to load historical data from a website in .csv-format. I have all the Tickernames(stock's short names) in one separate table and would like to use this one to load the historical data from the website instead of writing the LOAD-statement multiple times. Where I have "TickerName" I would like to loop the LOAD with TickerNames in a separate table. For exmaple, the load works if I change "TickerName" to "HM-B" which is the ticker name for H&M.

Will it be possible?

See below:

LOAD

     Date#(quote_date,'YYYYMMDD') AS QuoteDate,

     paper AS StockName,

     exch,

     open,

     high,

     low,

     close,

     volume,

     value

FROM

[http://www.netfonds.se/quotes/paperhistory.php?paper=TickerName.ST&csv_format=csv]

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

Thanks,

Alexander

Tags (2)
1 Solution

Accepted Solutions
Not applicable

Re: Re: Use reference in a different table in a load statement

Thanks, it was helpful!

I also found Another solution using the for-loop here:

http://community.qlik.com/blogs/qlikviewdesignblog/2013/09/02/loops-in-the-script

2 Replies
kristoferahlin
New Contributor III

Re: Use reference in a different table in a load statement

First load TickerName table, then try something like:

for i = 1 to FieldValueCount('TickerName');

  Let vTickerName= FieldValue('TickerName', $(1));

LOAD

     Date#(quote_date,'YYYYMMDD') AS QuoteDate,

     paper AS StockName,

     exch,

     open,

     high,

     low,

     close,

     volume,

     value

FROM

[http://www.netfonds.se/quotes/paperhistory.php?paper=$(vTickerName).ST&csv_format=csv]

(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

Next

Not applicable

Re: Re: Use reference in a different table in a load statement

Thanks, it was helpful!

I also found Another solution using the for-loop here:

http://community.qlik.com/blogs/qlikviewdesignblog/2013/09/02/loops-in-the-script

Community Browser