Skip to main content

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
cancel
Showing results for 
Search instead for 
Did you mean: 
Quy_Nguyen
Specialist
Specialist

Mashup - Build the "Show Details" feature

Hi everyone,

I am  implementing a feature in mashup like the "Show Details" feature in Qlik Sense hub. 

What I am having on app:

Quy_Nguyen_0-1620201604574.png

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"

Quy_Nguyen_1-1620201656092.png

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:

Quy_Nguyen_4-1620202702000.png

 

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:

Quy_Nguyen_5-1620203018310.png

The request also returned  empty string for description, but on the hub it is not empty:

Quy_Nguyen_6-1620203174261.png

** 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!

 

 

1 Solution

Accepted Solutions
Damien_Villaret
Support
Support

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"


If the issue is solved please mark the answer with Accept as Solution.

View solution in original post

3 Replies
Damien_Villaret
Support
Support

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"


If the issue is solved please mark the answer with Accept as Solution.
Quy_Nguyen
Specialist
Specialist
Author

Hello Damien,

Thank you for your support. I see it.

By the way, is there any way to get that information by App API? 

Damien_Villaret
Support
Support

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/

 

If the issue is solved please mark the answer with Accept as Solution.