Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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

1 Solution

Accepted Solutions
Not applicable
Author

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

View solution in original post

2 Replies
kristoferahlin
Partner - Contributor III
Partner - Contributor III

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
Author

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