Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
brindlogcool
Creator III
Creator III

Get visualization objects

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.

8 Replies
Aiham_Azmeh
Employee
Employee

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

brindlogcool
Creator III
Creator III
Author

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

Aiham_Azmeh
Employee
Employee

my mistake , reply should be sheets

[...] app.getList( 'sheet', function ( reply sheets ) { [...]

brindlogcool
Creator III
Creator III
Author

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);

});

Aiham_Azmeh
Employee
Employee

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);

    });

brindlogcool
Creator III
Creator III
Author

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)

                                                                                });

                                                                });

                                                ;

                                                });

Aiham_Azmeh
Employee
Employee

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,

Anonymous
Not applicable

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)