Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
frankpacker_AoD
Contributor III
Contributor III

Adding objects to sheet with JSON API

Hi all,

Hoping for some help with the final piece of a puzzle. I'm programmatically creating apps, sheets and then charts in QSE with the JSON API and I've successfully completed all of the steps except the final one.

I can create sheets no problem, but when I get to the final step of adding charts to the new sheets, I can't work out the final part.

If I execute the steps per Example 3 here then the list object and the chart are created as children of the sheet - showing up if 'GetChildInfos' or 'GetFullPropertyTree' is executed on the sheet's handle, however I seem to be missing a step that allows me to actually position these objects in the sheet's grid.

Running a  'GetProperties' on an ordinary sheet created via the QS Client shows a the property 'cells' containing this information for the sheet's children, example: 

{
	"jsonrpc": "2.0",
	"id": 7,
	"result": {
		"qProp": {
			"qInfo": {
				"qId": "eaaf1d06-1d7e-4a61-922a-cc0a974aa41e",
				"qType": "sheet"
			},
			"qExtendsId": "",
			"qMetaDef": {
				"title": "My new sheet",
				"description": ""
			},
			"qStateName": "",
			"rank": -1,
			"thumbnail": {
				"qStaticContentUrlDef": {
					"qUrl": ""
				}
			},
			"columns": 24,
			"rows": 12,
			"cells": [
				{
					"name": "nkBeCe",
					"type": "table",
					"col": 0,
					"row": 0,
					"colspan": 12,
					"rowspan": 11,
					"bounds": {
						"y": 0,
						"x": 0,
						"width": 50,
						"height": 91.66666666666666
					}
				},
				{
					"name": "YWpHuJC",
					"type": "text-image",
					"col": 12,
					"row": 0,
					"colspan": 12,
					"rowspan": 6,
					"bounds": {
						"y": 0,
						"x": 50,
						"width": 50,
						"height": 50
					}
				}
			],
			"qChildListDef": {
				"qData": {
					"title": "/title"
				}
			},
			"gridMode": "edit"
		}
	}
}

 

So my question is, can anyone tell me what the method is to position child objects in a sheet's grid, or whether there's documentation that I have failed to find showing this process?

Alternatively, creating the objects as children of the sheet is not the correct approach, and this needs to be achieved with a different set of methods...?

Thanks!

 

Labels (3)
2 Replies
Øystein_Kolsrud
Employee
Employee

You need to specify that "cells" property for the sheet object as well. That is how the client knows where to position the objects. That part seems to be missing from that example page you referred to. The definition of the sheets properties is an artifact of how the client is implemented and is not part of the public API. But it's easy enough to reverse engineer that part.

And I can recommend this tool if you want to look at property and layout structures for objects:

https://community.qlik.com/t5/Qlik-Sense-Documents/Qlik-Explorer-for-Developers/ta-p/1949809

ArtOfData
Partner - Contributor
Partner - Contributor

Nice! Thank you for that. I'll check out the tool and see if I can backtrack the right structure