Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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.
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.
Hi Steve,
Thanks for your reply and suggestion. Looks like a good idea.. But is there any Qlik function to find out environment??
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.
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.
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;