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: 
usuarioprueba991
Contributor
Contributor

Request for Assistance with Dynamic Visualization of Objects in Qlik

I'm currently developing an experimental application using the Qlik Embed API in a React environment. One of the features I am attempting to implement involves visualizing dynamically fetched objects from a specific sheet.My approach involves retrieving the object IDs into an array and subsequently iterating through this collection to dynamically generate visualizations using your QlikEmbed component. However, I'm struggling to get this to work as expected.
Could you please provide some guidance or potential solutions to resolve this issue? It would be greatly appreciated if you could point out any common pitfalls or considerations for this type of implementation.Thank you very much in advance for your assistance.

Labels (2)
2 Solutions

Accepted Solutions
usuarioprueba
Contributor
Contributor

@alex_colombo I wonder if there is a way to obtain all the objectIds (more than one objectId) in an array to dynamically render the objects related to an specific sheet without needing to look for each one separately.
I'm using QlikEmbed with React

View solution in original post

alex_colombo
Employee
Employee

@usuarioprueba for doing this you need to use our Engine API for retrievieng the list of the sheets, and then get all the objects within this specific sheet.
I'd suggest to use enigma.js (a wrapper on top of Engina APIs) into your React web application. With that you can interact with Engine APIs and you can get the sheet list:

//qlikApp: qlik application opened with enigma
const sheetDef = {
	"qInfo": {
		"qType": "SheetList"
	},
	"qAppObjectListDef": {
		"qType": "sheet",
		"qData": {
			"title": "/qMetaDef/title",
			"description": "/qMetaDef/description",
			"thumbnail": "/thumbnail",
			"cells": "/cells",
			"rank": "/rank",
			"columns": "/columns",
			"rows": "/rows"
		}
	}
}
//Create sheetList object
const sheetList = await qlikApp.createSessionObject(sheetDef)
//Get all the sheets information, such as sheet ids
const sheetsLayout = await sheetList.getLayout();
//Get specific sheet using sheet id
const sheet = await qlikApp.getObject(sheetsLayout.qAppObjectList.qItems[0].qInfo.qId)
//Get object list where you can find all the objects and their info such as position, chart id, chart name, etc..
const objectList = await sheet.getLayout()

 

View solution in original post

5 Replies
alex_colombo
Employee
Employee

Hi @usuarioprueba991 are you trying to render existing charts or are you trying to create visualizations on the fly based on existing charts?
Could you please share with us which error you are facing and your code?

usuarioprueba991
Contributor
Contributor
Author

Hi @alex_colombo I'm trying to dynamically render objects that already exist within an app. I tried using Qlik Sense Dev Hub's EngineAPIExplorer with different methods, but I couldn't find one that returns a JSON with the object IDs related to a certain sheet

alex_colombo
Employee
Employee

@usuarioprueba991 which API are you using for embed Qlik objects? 

If you are looking for sheet ID, look at your url and you can find it. Having this sample url, in bold you have the sheet id: https://my_server/sense/app/355d73bc-a789-47eb-bd47-0ce8f5c69ab2/sheet/75876dbe-6a31-4761-ac63-733c975269e5/state/analysis.

For getting the Qlik Sense object ID for embedding, you have to open the Qlik Sense app and right click on an object, then click on Share and then on Embed. You will see the object id like below:

usuarioprueba
Contributor
Contributor

@alex_colombo I wonder if there is a way to obtain all the objectIds (more than one objectId) in an array to dynamically render the objects related to an specific sheet without needing to look for each one separately.
I'm using QlikEmbed with React

alex_colombo
Employee
Employee

@usuarioprueba for doing this you need to use our Engine API for retrievieng the list of the sheets, and then get all the objects within this specific sheet.
I'd suggest to use enigma.js (a wrapper on top of Engina APIs) into your React web application. With that you can interact with Engine APIs and you can get the sheet list:

//qlikApp: qlik application opened with enigma
const sheetDef = {
	"qInfo": {
		"qType": "SheetList"
	},
	"qAppObjectListDef": {
		"qType": "sheet",
		"qData": {
			"title": "/qMetaDef/title",
			"description": "/qMetaDef/description",
			"thumbnail": "/thumbnail",
			"cells": "/cells",
			"rank": "/rank",
			"columns": "/columns",
			"rows": "/rows"
		}
	}
}
//Create sheetList object
const sheetList = await qlikApp.createSessionObject(sheetDef)
//Get all the sheets information, such as sheet ids
const sheetsLayout = await sheetList.getLayout();
//Get specific sheet using sheet id
const sheet = await qlikApp.getObject(sheetsLayout.qAppObjectList.qItems[0].qInfo.qId)
//Get object list where you can find all the objects and their info such as position, chart id, chart name, etc..
const objectList = await sheet.getLayout()