Last active
July 31, 2019 17:10
-
-
Save gsbeaton/8a9605e411ad2d10eaefe1876f3e03c2 to your computer and use it in GitHub Desktop.
A QlikView and QlikSense script to generate variables from a CSV include.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
| ------------------------------------------------------------------- | |
| Create Variables | |
| ------------------------------------------------------------------- | |
| Loads data from the Variables repository and loops through to | |
| create a valid variable for each row of the repo. | |
| | |
| Set your CSV doc up like this: | |
| | |
| VariableName, VariableValue, Comments | |
| vUserName, "SubField(OSUser(),'\',2)", "The logged on user's name" | |
| vSheetNameHelper, "if(GetActiveSheetId()=$1,'pass','fail')" | |
| | |
*/ | |
Variables: | |
LOAD VariableName | |
,VariableValue | |
,Comments | |
FROM | |
[..\QVS_Source\Variable_Repo.csv] | |
(txt, utf8, embedded labels, delimiter is ',', msq); | |
// create the variables for the application security. | |
FOR i=0 to NumMax(NoOfRows('Variables'),0)-1; | |
LET TempVarName = peek('VariableName',$(i),'Variables'); | |
LET $(TempVarName) = peek('VariableValue',$(i),'Variables'); | |
NEXT | |
LET TempVarName = NULL(); | |
LET TempVarValue = NULL(); | |
DROP Table Variables; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment