Skip to main content Skip to complementary content

GetSysAttr - script and chart function

This function returns the tenant and space domain attributes for a selected app. It can be used in both the data load script and in a chart expression.

The GetSysAttr() function can be used directly in the load script or in a chart expression. In either case, you can use the function to store attributes in a variable, or directly without a variable.

If you use this function in Qlik Sense Client-Managed, it only returns empty data values. Therefore, you can use the function to develop scripts in Qlik Sense Client-Managed without encountering errors, with the intention of later uploading the apps to Qlik Cloud.

Syntax:  

GetSysAttr(name)

Return data type: dual

Arguments
Argument Description
name The name of the attribute to return. Enter as a string value in the expression. The string value entered is case-sensitive.

You can use the function to load environment attributes into your app. The function can return the following attributes:

Environment attributes that can be returned by the GetSysAttr() function
Attribute Description Example of load script variable Example of chart expression (no variable)
tenantId The tenant ID. Let vTenantID = GetSysAttr('tenantId') =GetSysAttr('tenantId')
tenantName The name of the tenant. Let vTenantName = GetSysAttr('tenantName') =GetSysAttr('tenantName')
tenantUrl The default URL for the tenant. Let vTenantUrl = GetSysAttr('tenantUrl') =GetSysAttr('tenantUrl')
tenantUrlAlias The alias URL that has been defined for the tenant. Let vTenantUrlAlias = GetSysAttr('tenantUrlAlias') =GetSysAttr('tenantUrlAlias')
tenantRegion The region in which the tenant resides. Let vTenantRegion = GetSysAttr('tenantRegion') =GetSysAttr('tenantRegion')
spaceId

The space ID. This is only defined for an app in a shared or managed space.

Information note

If the GetSysAttr() function returns an empty spaceId value in Qlik Cloud, this indicates that the app is located in a personal space.

The GetSysAttr() function always returns an empty spaceId value when used in Qlik Sense Client-Managed.

Let vSpaceId = GetSysAttr('spaceId') =GetSysAttr('spaceId')
spaceName

The name of the space. This is only defined for an app in a shared or managed space.

Information note

If the GetSysAttr() function returns an empty spaceName value in Qlik Cloud, this indicates that the app is located in a personal space.

The GetSysAttr() function always returns an empty spaceName value when used in Qlik Sense Client-Managed.

Let vSpaceName = GetSysAttr('spaceName') =GetSysAttr('spaceName')
spaceType

The type of space in which the app is located. This is only defined for an app in a shared or managed space.

Information note

If the GetSysAttr() function returns an empty spaceType value in Qlik Cloud, this indicates that the app is located in a personal space.

The GetSysAttr() function always returns an empty spaceType value when used in Qlik Sense Client-Managed.

Let vSpaceType = GetSysAttr('spaceType') =GetSysAttr('spaceType')

When to use it

This function simplifies space and tenant identification of a Qlik Sense app that might be moved between different environments. The function makes it easy to identify the specific environment you are working in. This is particularly useful during the development, testing, acceptance and production (DTAP) stages of an app's life cycle.

This function can be used in load statements in the app's load script or chart expressions, either directly as an expression or in an expression stored as a variable. If you anticipate your app being moved between spaces or tenants during its life cycle, use the function in a chart expression to dynamically obtain space and tenant information without reloading the app. When doing so, store the function expression in a variable outside the load script, or use the function directly in the chart expression.

Example 1 – Storing environment attributes as load script variables

Example 2 – Storing environment attributes as variables and using them in chart expressions

Example 3 – Using the function directly in the load script

Example 4 – Using the function directly in chart expressions

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!