Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I am implementing a feature in mashup like the "Show Details" feature in Qlik Sense hub.
What I am having on app:
Master dimension definition: I am using some custom UI function (variable with input) for getting multilingual label/description like this ( =$(fUI_LanguageGetText(POS_Article_No_Title)) ). This dimension is being used on the bar chart above and shown the correct value in "Show details" view. Its ID: "4e42aae9-1e9e-4f60-94c0-e4da8e17226b"
The idea is getting charts info and also master dimensions/measures info from App API.
I used this code block to get the dimension list:
app.getList("DimensionList", function(reply) {
console.log(reply);
})
But the API result is empty for the description of the dimension above:
It looks like API doesn't return the correct evaluated expression.
Then I tried to open DevTools on web browser and see what happened on the app when I click "Show Details" icon on Qlik Sense hub. This is the request result from API Engine:
The request also returned empty string for description, but on the hub it is not empty:
** If I use a plain text for it (e.g. "Test description") instead of the variable string, app API and Engine API return that text in the description normally.
Since using variables for description/label is required in my app for the multilingual, I want to ask if there is any way we could get them by API?
I was totally stuck with this. Any lead would be much appreciated!
Thank you!
Hello @Quy_Nguyen
With the Engine API, you would just need to do a GetDimension() or GetMeasure() then do a get layout on the dimension/measure specifying the handle you got from GetDimension()/GetMeasure()
{
"handle": 1,
"method": "GetDimension",
"params": {
"qId": "QFQTy"
}
}
Response:
{
"jsonrpc": "2.0",
"id": 8,
"delta": true,
"result": {
"qReturn": {
"qType": "GenericDimension",
"qHandle": 3,
"qGenericType": "dimension",
"qGenericId": "QFQTy"
}
}
}
GetLayout() request:
{
"handle": 3,
"method": "GetLayout",
"params": {}
}
Response:
{
"jsonrpc": "2.0",
"id": 9,
"delta": true,
"result": {
"qLayout": {
"qInfo": {
"qId": "QFQTy",
"qType": "dimension"
},
"qMeta": {
"privileges": [
"read",
"update",
"delete",
"exportdata",
"approve"
],
"title": "StaticName",
"description": "",
"tags": []
},
"qDim": {
"qGrouping": "N",
"qFieldDefs": [
"=Avg(Expression1)"
],
"qFieldLabels": [
"StaticName"
],
"qLabelExpression": "267932",
"title": "StaticName",
"descriptionExpression": "946",
"coloring": {
"changeHash": "0.3148510142163914"
}
},
"qDimInfos": [
{
"qApprMaxGlyphCount": 0,
"qCardinal": 0,
"qTags": []
}
]
}
}
}
You can see the calculated value of description in "DescriptionExpression"
Hello @Quy_Nguyen
With the Engine API, you would just need to do a GetDimension() or GetMeasure() then do a get layout on the dimension/measure specifying the handle you got from GetDimension()/GetMeasure()
{
"handle": 1,
"method": "GetDimension",
"params": {
"qId": "QFQTy"
}
}
Response:
{
"jsonrpc": "2.0",
"id": 8,
"delta": true,
"result": {
"qReturn": {
"qType": "GenericDimension",
"qHandle": 3,
"qGenericType": "dimension",
"qGenericId": "QFQTy"
}
}
}
GetLayout() request:
{
"handle": 3,
"method": "GetLayout",
"params": {}
}
Response:
{
"jsonrpc": "2.0",
"id": 9,
"delta": true,
"result": {
"qLayout": {
"qInfo": {
"qId": "QFQTy",
"qType": "dimension"
},
"qMeta": {
"privileges": [
"read",
"update",
"delete",
"exportdata",
"approve"
],
"title": "StaticName",
"description": "",
"tags": []
},
"qDim": {
"qGrouping": "N",
"qFieldDefs": [
"=Avg(Expression1)"
],
"qFieldLabels": [
"StaticName"
],
"qLabelExpression": "267932",
"title": "StaticName",
"descriptionExpression": "946",
"coloring": {
"changeHash": "0.3148510142163914"
}
},
"qDimInfos": [
{
"qApprMaxGlyphCount": 0,
"qCardinal": 0,
"qTags": []
}
]
}
}
}
You can see the calculated value of description in "DescriptionExpression"
Hello Damien,
Thank you for your support. I see it.
By the way, is there any way to get that information by App API?
Hello,
I have checked but unfortunately that is not possible with App API.
If you want to call the Engine API with javascript, you can use enigma.js in your mashup.
https://github.com/qlik-oss/enigma.js/