Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: aorlovskyIntroducing bretemplate.qvw
The QlikView document
bretemplate.qvw is an example of how you can use qvx files exported from BRE to supply data to QlikView.
Each time you export pin data to bretemplate.qvw it persists the pin data in qvd file. The QlikView user can use all the data exported so far immediately on export. Because the data for each pin is persisted, you can open the bretemplate.qvw file and use all the exported data even if BRE is not running.
This document contains only one sheet. This sheet contains a table that displays a table of node.pin names and corresponding qvd files.
It does not contain any tables showing pin data. They must be created by hand.
The first time you export from a particular pin in BRE, you can add various a Sheet Object, such as a Table Box, and then configure it to display data in QlikView. Be sure to save the qvw file. Subsequent exports of the same pin in the same graph will automatically update the data stored and displayed in QlikView.
Setting up to use bretemplate.qvw
Copy it to c:\lavastorm\dataviewer
For each graph you want to export from:
Add a subdir c:\lavastorm\dataviewer\graphName
Copy bretemplate.qvw to c:\lavastorm\dataviewer\graphName
In BRE you’ll want to configure a qvx data viewer with the following command line:
c:\Program Files\QlikView\Qv.exe /l /vgraph={{^graph^}} /vinputQvx={{^data^}} /vpin={{^pin^}} c:\lavastorm\dataviewer\{{^graph^}}\bretemplate.qvw
This says run the open a QlikView document named bretemplate.qvw using “load” option, passing in values for the “graph”, “inputQvx” and “pin” variables.
Note that we use the graph name as the subdirectory name.
This command line example is also described in the 4.6.0 BRE Help.
Details on the qlikview bretemplate script:
Main
Just defines constants.
If you change where you store your qvw and qvd files, be sure to change the value of vQvdFile
Subs
Defines subroutines Bre.LoadTable, Bre.SaveQvd, Bre.PopulatePinTables
Bre.SaveQvd(_graphName, _pinName)
Persists table data in a qvd.
Writes the table called _pinName in the qvd file named c:\lavastorm\dataviewer\$(_graphName)\$(_pinName). qvd
Then records the pinName, qvdFileName pair in the Pins table.
Bre.LoadTable(_graphName, _tableName, _inputQvx)
Writes the data in _inputQvx to a table called _tableName.
Then persists this data in a qvd using Bre.SaveQvd
Bre.PopulatePinTables
Given the name of the Pins table, loads data for every pinName/qvdFileName pair.
Load
Reads the data for the Pins table if there is any (if we’ve exported from BRE before.)
Save
Stores the given qvx using Bre.LoadTable
Stores the Pins table into its qvd.
Now everything is persisted.
Fills all pin tables with persisted data using Bre.PopulatePinTables
Changing where the QlikView documents reside.
Our sample code assumes qvw and qvds are stored in c:\lavastorm\dataviewer. If you want it to live elsewhere you must change these references:
In BRE your QlikView command line refers to a qvw file under this directory
In bretemplate.qvw scripts, the value of vQvdFile, which is defined in the Main tab.
In bretemplate.qvw scripts, the directory name appears in Bre.SaveQvd, which is defined in the Subs tab.