Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
elenarudelli
Contributor II
Contributor II

Identify space name - both managed and shared

Hallo community,

we have one tenant, that must be used both as production environment and developent one.

As production environment we have defined two managed spaces: "SpaceA" and "SpaceA_DataConnection".

As development environment we have defined two shared spaces: "DEV_SpaceA" and "DEV_SpaceA_DataConnection".

In order to publish apps automatically, we need to identity the Space Name, so that we would be able to parametrize all paths' variables.

We expect to write a script such as:

Let vs_SpaceName = ???;
if(left('$(vs_SpaceName)',3)='DEV') then
ConnectionPrefix='DEV_';
else
ConnectionPrefix='';
End if
Let vs_pathDwStaging = 'lib://$(ConnectionPrefix)SpaceA_DataConnection:Staging';

 Many thanks and best regards,

Elena

Labels (3)
1 Solution

Accepted Solutions
FedericoDellAcqua
Contributor II
Contributor II

Hello Elena,

The function GetSysAttr() will return you some information about your system. 

For your scenario, the argument of the function must be 'SpaceName'. 

So let a variable be like "=GetSysAttr('spaceName')".

Find more here . 

Federico.

View solution in original post

5 Replies
F_B
Specialist
Specialist

Looks interesting.

elenarudelli
Contributor II
Contributor II
Author

Hi,

below I post the solution my colleague and I have implemented this morning. You will notice that we need to point to .qvd saved by the monitoring app "Events Monitoring" (rif. https://community.qlik.com/t5/Official-Support-Articles/The-Qlik-Sense-Monitoring-Applications-for-C... ).

Let vs_DocumentName = DocumentName();

SpaceDetails:
LOAD
AppID,
SpaceID
FROM [lib://Monitoring Apps Data:DataFiles/Apps.qvd]
(qvd)
where AppID = '$(vs_DocumentName)'
;
left join (SpaceDetails)
LOAD
SpaceID,
"Space Name" as SpaceName
FROM [lib://Monitoring Apps Data:DataFiles/Spaces.qvd]
(qvd);

let vs_SpacePrefix = left(peek('SpaceName', 0, 'SpaceDetails'),3);

If('$(vs_SpacePrefix)' = 'DEV') then
let vs_ConnectionPrefix = 'DEV_';
else
let vs_ConnectionPrefix = '';
end if

drop table SpaceDetails;
Let vs_DocumentName = Null();
Let vs_SpacePrefix = Null();

Have anyone a best solution without using .qvd created by monitoring apps (and without REST connection), but using something like "ComputerName()" in enterprise environments?

Many thanks,

Elena

 

anat
Master
Master

elenarudelli
Contributor II
Contributor II
Author

Hi Anat,

Many thanks for the suggestion.

In the post you have linked the difference between DEV and PROD environment is made also in app's name, that's why it is not necessary to know the space's name. This is an idea, but we like to follow another strategy to separe DEV and PROD environment.

Best regards,

Elena

FedericoDellAcqua
Contributor II
Contributor II

Hello Elena,

The function GetSysAttr() will return you some information about your system. 

For your scenario, the argument of the function must be 'SpaceName'. 

So let a variable be like "=GetSysAttr('spaceName')".

Find more here . 

Federico.