Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is it possible to retrieve all the objects(Charts,KPI) from Qlik Sense using the API?
I have used the getAppList to get list of apps.
But the getAppObjectList gives only the sheet details.
Hi brindlogcool,
We are keeping all objects under this hierarchy: sheet > objects; so you will have to loop trough the sheet list to get the object list:
var objectList = [];
app.getList( 'sheet', function ( reply ) {
reply.qAppObjectList.qItems.forEach( function ( value ) {
value.qData.cells.forEach( function ( object ) {
objectList.push(object);
});
});
Of course you can also use getAppObjectList method too, but I will not recommend it, it has been deprecated from v1.1.
I hope this helps,
regards
Thanks for your response @Aiham Azmeh ,
Tried to use app.getlist but getting the error as "require.js:44 ReferenceError: sheets is not defined"
My QlikSense version is 2.2
my mistake , reply should be sheets
[...] app.getList( 'sheet', function ( reply sheets ) { [...]
Sorry, still something is missing . It's not working- "sheets.forEach is not a function"
var objectList = [];
app.getList( 'Sheet', function ( sheets ) {
sheets.forEach( function (value) {
value.qData.cells.forEach( function ( object ) {
objectList.push(object);
});
});
alert(objectList);
});
again my mystake, I am trying to code blindly:
switch sheets to sheets.qAppObjectList.qItems
sheets.forEach( function (value) {
sheets.qAppObjectList.qItems.forEach( function (value) {
value.qData.cells.forEach( function ( object ) {
objectList.push(object);
});
Thanks for your patient response. It was very helpful. Something I, have missed from my end and keep getting the error. so used the getAppObjectList and it works in 2.2. But you have mentioned it is depreciated. So what are other options we have??
app.getAppObjectList('sheet', function (reply) {
var str = "";
$.each(reply.qAppObjectList.qItems, function (key, value) {
str += value.qData.title + ' ';
console.log(str)
$.each(value.qData.cells, function (k, v) {
str += v.name + ' ';
console.log(str)
});
});
;
});
As mentioned in the documentation "app.getList" is replacing "app.getObjectList" getAppObjectList method ‒ Qlik Sense
Anyway, strange that you keep getting errors, you should be able to just switch the method name and everything will work.
regards,
I had a simillar problem and found out why he was getting an error - there is a simple mistake in documentation here: getList method ‒ Qlik Sense
You don't need capital letter for 'sheet' type of obejct.
Not working:
qlik.app.getList('Sheet', callback)
Working:
qlik.app.getList('sheet', callback)