8 Replies Latest reply: Nov 8, 2016 7:46 AM by Yan Ivan Evdokimov RSS

    Get visualization objects

    Logesh Jayaraman

      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.

        • Re: Get visualization objects
          Aiham Azmeh

          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

            • Re: Get visualization objects
              Logesh Jayaraman

              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

                • Re: Get visualization objects
                  Aiham Azmeh

                  my mistake , reply should be sheets

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

                    • Re: Get visualization objects
                      Logesh Jayaraman

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

                      });

                        • Re: Get visualization objects
                          Aiham Azmeh

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

                              });

                            • Re: Get visualization objects
                              Logesh Jayaraman

                              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)

                                                                                                              });

                                                                                              });

                                                                              ;

                                                                              });