Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE

How to use variables as Title in Qlik Sense objects using Engine API.

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Sonja_Bauernfeind
Digital Support
Digital Support

How to use variables as Title in Qlik Sense objects using Engine API.

Last Update:

May 31, 2021 11:44:11 AM

Updated By:

Sonja_Bauernfeind

Created date:

Feb 8, 2018 4:39:46 AM

How to - "Use a variable as Title in Qlik Sense objects using Engine API's CreateDimension() method".

The requirement is to display the values inside a variable as a Title in a Qlik Sense object using Engine API.

For example: We have a variable vTitle in our Qlik Sense application which contains some value. In our case vTitle = 1111111.

Now, we want to create a Table object and display the Label as "1111111" instead of the Field name (Field created using Engine API's method).


Note: There is a difference between "Name" field & "Label expression" field in Qlik Sense.

The "Name " field doesn't support use of any Formulas (refer to the below screenshot). Only the "Label expression" field can support use of formulas (Symbol Fx gives us that HINT).

Edit Dimension.png


 

Resolution:


Use the following code to create a master dimension and use a variable expression as Title for Labels:

{
"handle": 1,
"method": "CreateDimension",
"params": {
"qProp": {
"qInfo":

{ "qType": "dimension" }
,
"qDim": {"title": "something", "qGrouping": "N", "qFieldDefs": [ "City" ], "qFieldLabels": [ "City Label" ], "qLabelExpression": "=$(vTitle)" }
,
"qMetaDef": {
"title": "avenger"
}
}
}
}




The property that needs to be used is: "qLabelExpression": "=$(vTitle)" 



Once we create a Master dimension using the above code, we create a simple Table & use the Dimension "avenger" in my table & as expected it displays the Label as the value inside variable vTitle. 


table 11111.png
 

Environment:

Qlik Sense Enterprise on Windows 

Labels (1)
Contributors
Version history
Last update:
‎2021-05-31 11:44 AM
Updated by: