Adding Data to Memory with Partial Reloads
The Add Load statement is wonderful for adding data to memory and making it instantly available to all AJAX client users. It is an alternative to DynamicUpdate, which I will talk about in near future, for relatively large additions or changes. Previously I provided an example of getting real time quotes by parsing JSON returned by Yahoo API service. In that example we can replace the Load statements with Add Load, and schedule Partial Reloads every 5 minutes to get near real time pulse on the market.
Tmp:
Add Load
json2csv(@1, 'query.results.quote') as CSV
From [http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22YHOO%22%2C%22AAPL%22%2C%22GOOG%22%2C%22MSFT%22)%0A%09%09&env=http%3A%2F%2Fdatatables.org%2Falltables.env&format=json] (txt, utf8, no labels, delimiter is '');
Quotes:
Add LOAD * FROM_FIELD (Tmp, CSV)
(txt, utf8, embedded labels, delimiter is ',', msq);
Drop Table Tmp;
Note that with the Publisher license it is straightforward to schedule Partial Reloads by using the QlikView Management Console (QMC). However without Publisher you can only schedule full reloads. To workaround you can schedule a batch file from Windows scheduler that uses QV.EXE command line option /rp for partial reload.
qv.exe /rp c:\ProgramData\QlikTech\Documents\stocks.qvw
The beauty of all of this is that QlikView is grabbing, storing, processing and presenting data. Database and application servers are not required.
No comments:
Post a Comment