Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
vish123
Creator III
Creator III

Is there anyway to find out Qlik Sense Environment (Whether it is Dev or UAT or Prod) in the load script editor??

Hi Team,

I have a requirement to find out the environment (Dev or UAT or Prod) dynamically with in Qlik Sense Load script editor based upon the environment in which app is deployed on. Please suggest if it is possible??

Thanks,

Vishnu

1 Solution

Accepted Solutions
stevejoyce
Specialist II
Specialist II

You can store a .txt file in your qlik data directory "vEnvrionment.txt".  In each envrionment store its respective name (set vEnvrionment = Dev, or set vEnvrionment = UAT, or set vEnvrionment = Prod).  Your load script will load the "vEnvrionment.txt" and so now in each envrionment it will be different.

View solution in original post

4 Replies
stevejoyce
Specialist II
Specialist II

You can store a .txt file in your qlik data directory "vEnvrionment.txt".  In each envrionment store its respective name (set vEnvrionment = Dev, or set vEnvrionment = UAT, or set vEnvrionment = Prod).  Your load script will load the "vEnvrionment.txt" and so now in each envrionment it will be different.

vish123
Creator III
Creator III
Author

Hi Steve,

Thanks for your reply and suggestion. Looks like a good idea.. But is there any Qlik function to find out environment??

stevejoyce
Specialist II
Specialist II

The only thing technically distinguishing on Qlik's side is the license type.  I would think it's overkill to try and read the license definition.  Plus license can be used multiple times (i.e. in your case Dev and UAT probably share same test license).  

You could try using ComputerName() and having a mapping of computer names -> environment type.  But i would keep that mapping external to all your load scripts, because if you ever need to change servers/names you'd want to go into 1 place to update mapping and not every load script.

 

WillyX
Contributor
Contributor

You could add a tag on the node or engine to distinguish the environment. Then you can request the repository DB to get the info matching the computername and the tag associated.

WillyX_0-1671720583303.png

 

Let vServerName = lower(computername());

// connect to QLik repository DB 
LIB CONNECT TO 'QlikSenseDB';

// get tag associated to the server (to define the environment)
[ServerNodeConfigurations]:
LOAD 
	ID	as ServerNodeConfiguration_ID,
    HostName
where lower(subfield(HostName,'.',1)) = '$(vServerName)';
SELECT
	"ID",
	"HostName"
FROM "public"."ServerNodeConfigurations";

left join
[TagServerNodeConfigurations]:
LOAD
	ServerNodeConfiguration_ID, 
	Tag_ID;
SELECT
	"ServerNodeConfiguration_ID",
	"Tag_ID"
FROM "public"."TagServerNodeConfigurations";

left join(ServerNodeConfigurations)
[Tags]:
LOAD
	ID		as Tag_ID, 
	Name	as Env;
SELECT "ID",
	"Name"
FROM "public"."Tags";

disconnect;