Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
alexis
Partner - Specialist
Partner - Specialist

Variable for LOAD source

I  have a number of Qlik Sense application that I develop and test in 3 different environments
- Desktop
- On-Premise Enterprise 
- SaaS

The FROM statement (see example below) varies from environment to environment. Every time I move environments I go through the laborious task of commenting and uncommenting the right FROM statement - this is very time consuming. Can anyone suggest a better approach: 

ProductDescriptions:
LOAD SP_Product,
     SP_ProductDescription
FROM
//[lib://MiscData_Folder (cypapp3_alexis)/Products.xlsx]   //On-Premise Server version
//[lib://MiscData_Folder/Products.xlsx]  // Desktop version
[lib://DataFiles/Products.xlsx] // SaaS environment - everything has to go into the "DataFiles" folder

 

Labels (1)
1 Solution

Accepted Solutions
Mark_Little
Luminary
Luminary

HI @alexis 

As you suggest in the title, use variables. 

I used a similar approach to change my libraries. 

//Setup Connection for dashboard state i.e. Development 1=Development, 2=UAT, 3=Production
//SET vState = 1; //Development
//SET vState = 2; //UAT
SET vState = 3; //Production

IF $(vState) = 1 THEN
SET vPath = 'Development';
ENDIF;

IF $(vState) = 2 THEN
SET vPath = 'UAT';
ENDIF;

IF $(vState) = 3 THEN
SET vPath = 'Production';
ENDIF;

 

then instead of the library name i add the variable $(vPath).

You can put anything in the variable, library or part/full paths. Then you just change the State variable and it loads from the new location.

View solution in original post

2 Replies
Mark_Little
Luminary
Luminary

HI @alexis 

As you suggest in the title, use variables. 

I used a similar approach to change my libraries. 

//Setup Connection for dashboard state i.e. Development 1=Development, 2=UAT, 3=Production
//SET vState = 1; //Development
//SET vState = 2; //UAT
SET vState = 3; //Production

IF $(vState) = 1 THEN
SET vPath = 'Development';
ENDIF;

IF $(vState) = 2 THEN
SET vPath = 'UAT';
ENDIF;

IF $(vState) = 3 THEN
SET vPath = 'Production';
ENDIF;

 

then instead of the library name i add the variable $(vPath).

You can put anything in the variable, library or part/full paths. Then you just change the State variable and it loads from the new location.

alexis
Partner - Specialist
Partner - Specialist
Author

Thanks @Mark_Little  for the suggestion - I adapted it to my requirements and works perfectly.