Hello All,
and welcome to another post of the blog series. You must have seen that I have changed the URL from 'shapeandqlikdata' to 'bishapes', the reason behind same, is I would like to cover topics not only related to Qlik but also w.r.t. complete BI. So check out his space for more and more articles related to BI industry.
Coming back to the article, in this article I am going to tell you regarding Variables in QlikView. Variables play an important role in QlikView. They can store values, expressions etc. which can be used in the QlikView Document. We can easily create and delete variables from “Variable Overview” window –
Now suppose, we have 500 variables which we have stored in excel sheet and now we want to add those in QlikView. To add 500 variables in QlikView is a time consuming task.
To achieve this, we can follow below steps –
- Suppose, we have a excel sheet with two columns as Value and Variable
- We have to write below code to fetch the variables inside QlikView in the Edit Script part of QlikView
Table_Variables:
LOAD Text as Value,
Variable
FROM
<excel file_name_along_with_location>
(ooxml, embedded labels, table is <sheet_tab_name>);
// Create variables
for i = 0 to NoOfRows('Table_Variables') - 1
let vName = peek('Variable', i, 'Table_Variables'); // Name of the variable
let $(vName) = peek(' Value', i, 'Table_Variables') ;//& chr(10) & '/ $(vComment) /'; // Expression
next I;
- Reload the application
- It will create all the variables in the QlikView along with Value
Benefits of using this method –
- Saves time, as number of variables can be loaded within seconds
- Maintaining variable values is easy
- If there is change in any of the variable, we just have to drop the table and again use above code, to have fresh values of variables
That's it for this post, please provide your comments for any feedback or queries.
Stay tuned for more articles...!!!

No comments:
Post a Comment