Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rbartley
Specialist II
Specialist II

Extracting all visualizations in an app

Hello everyone,

I'm thinking of writing a script to automate the creation of mashups and to start I thought I'd use the Engine API to extract the IDs and types of all visualizations within an app.  Does anyone know if there's a way to do this without using the GetObjects method of a document and specifying every type of visualization?  When I specify the object type, I get the result I expect, while when I pass an empty qTypes option, it returns an empty reply:

This works:

 

 

 

{
	"handle": 1,
	"method": "GetObjects",
	"params": {
		"qOptions": {
			"qTypes": [
				"barchart"
			],
			"qIncludeSessionObjects": false,
			"qData": {}
		}
	}
}

 

 

and returns:
 

 

 

{
	"jsonrpc": "2.0",
	"id": 5,
	"delta": true,
	"result": {
		"qList": [
			{
				"qInfo": {
					"qId": "bbb31edd-f836-4bb1-a826-7a230d14f760",
					"qType": "barchart"
				},
				"qMeta": {
					"title": "xxxx",
					"description": "",
					"tags": []
				},
				"qData": {}
			},
			{
				"qInfo": {
					"qId": "98e3d4a1-8e2f-40df-8f80-55e40072dc74",
					"qType": "barchart"
				},
				"qData": {}
			}
		]
	}
}

 

 

 
 
This doesn't:
 

 

{
	"handle": 1,
	"method": "GetObjects",
	"params": {
		"qOptions": {
			"qTypes": [
				""
			],
			"qIncludeSessionObjects": false,
			"qData": {}
		}
	}
}

 

 

Returns:

 

{
	"jsonrpc": "2.0",
	"id": 6,
	"delta": true,
	"result": {
		"qList": []
	}
}

 

 

Is there a wildcard or keyword that would allow me to retrieve all visualizations, regardless of the type?

 

Thanks in advance.

 

Regards,

 

Richard

Labels (2)
12 Replies
rbartley
Specialist II
Specialist II
Author

OK, as per my previous snippet then.

Thanks for all your help.

Regards,

 

Richard

rbartley
Specialist II
Specialist II
Author

Hi @Aiham_Azmeh ,

If  I have multiple filter panes for which I want to get the number of lists in the pane, is there a response message attribute that I can use so that I can use this instead of using message ids?  e.g.

 

 

 

var msg = JSON.parse(event.data);

if(msg.result.qReturn.qGenericType)
  {objType=msg.result.qReturn.qGenericType;}
else 
  {objType=msg.result.qReturn.qType;}
????????
    
switch(objType) {
   
	case "Doc":
		ws.send(JSON.stringify(getSheetList));
		break;
	case "SheetList":
		ws.send(JSON.stringify(getSheetContent));
		break;   
	... 
	...
	case "FilterPane"
		ws.send(JSON.stringify(getLists));
		break;
	... 
	...

 

 

The issue I have is that the filterpane type appears to be GenericObject, which is not very helpful in my case.

 

Thanks in advance.

rbartley
Specialist II
Specialist II
Author

In fact, I see that the response to the GetObjects with parameter "qTypes": ["filterpane"] returns a list with members of qtype filterpane

{
	"jsonrpc": "2.0",
	"id": 5,
	"delta": true,
	"result": {
		"qList": [
			{
				"qInfo": {
					"qId": "e9246f16-9e9f-4fb4-a00a-bd92ed7b9add",
					"qType": "filterpane"
				},
				"qData": {}
			},
			{
				"qInfo": {
					"qId": "67f95aaa-ae99-44a3-898c-fabd242346ec",
					"qType": "filterpane"
				},
				"qData": {}
			}
		]
	}
}

While the GetObject call returns an object with qGenericType "filterpane"

{
	"jsonrpc": "2.0",
	"id": 6,
	"delta": true,
	"result": {
		"qReturn": {
			"qType": "GenericObject",
			"qHandle": 3,
			"qGenericType": "filterpane",
			"qGenericId": "e9246f16-9e9f-4fb4-a00a-bd92ed7b9add"
		}
	}
}

 

And GetLayout on this returns a childList with members of qType "listbox"

{
	"jsonrpc": "2.0",
	"id": 7,
	"delta": true,
	"result": {
		"qLayout": {
			"qInfo": {
				"qId": "e9246f16-9e9f-4fb4-a00a-bd92ed7b9add",
				"qType": "filterpane"
			},
			"qSelectionInfo": {},
			"qChildList": {
				"qItems": [
					{
						"qInfo": {
							"qId": "bd9c9e17-7fc9-47a3-8bfb-6b96f9a4bdfa",
							"qType": "listbox"
						},
						"qData": {
							"info": ""
						}
					},
					{
						"qInfo": {
							"qId": "29ea0fc0-13cd-41da-afd6-efb179ee2ff1",
							"qType": "listbox"
						},
						"qData": {
							"info": ""
						}
					},
					{
						"qInfo": {
							"qId": "8daada98-5543-4731-91b4-e97afb96362a",
							"qType": "listbox"
						},
						"qData": {
							"info": ""
						}
					}
				]
			},
			"showTitles": false,
			"title": "",
			"subtitle": "",
			"footnote": "",
			"visualization": "filterpane"
		}
	}
}

I should be able to get what I need from this.