2 Replies Latest reply: Apr 11, 2017 8:21 AM by praveena mundolimoole RSS

    Export pivot table to Excel in Qliksense mashup

    Davide Dainese

      Goodmorning Qlik Community,

       

      I would know if there is a way to export a pivot table object to Excel...I've toke a look to api reference

      (exportData method ‒ Qlik Sense)

      but I can't understand in which way I can create a qTable from Pivot object.

       

      Thanks for help...

        • Re: Export pivot table to Excel in Qliksense mashup
          ido gridish

          Same here,

          if someone can provide an explanation about the cod below and how to implement it it would be excellent,

          exportData method ‒ Qlik Sense

           

          *****************************************js*******************************************

          var qTable = qlik.table(this); 

          var $exportButton = $( document.createElement('button')); $exportButton.html('Export'); $exportButton.bind('click', function (  ) { qTable.exportData({download: true}); });

          $element.append($exportButton);


          ******************************************html******************************************


          <button ng-click="table.exportData({download:true})">Create Excel file</button>


            • Re: Export pivot table to Excel in Qliksense mashup
              praveena mundolimoole

              You can export the data using one of the below methods.

               

              Method 1 :- Pass the html element id ('QV06') and qlik sense object id ('uETyGUP') as shown below.

              require(["js/qlik"], function (qlik) {
                app.getObject('QV06', 'uETyGUP').then(function (visual) {
                var qTable = qlik.table(visual);
                qTable.exportData({ download: true });
                });
              });
              

               

              Method 2 :- Create table by passing the hypercube dimensions and measured and export the table.

              // Get current app.  
              var app = qlik.currApp($('#QV01'));  
                
                
              // Create table using table API.  
              var table = app.createTable([{ "qDef": { "qFieldDefs": ["Case Owner Group"], "qFieldLabels": ["Group"] } },  
                                          { "qDef": { "qFieldDefs": ["CaseNumber"], "qFieldLabels": ["CaseNumber"] } }  
                                          ],  
                [{ "qDef": { "qDef": "Sum( [Open Cases] )", "qLabel": "Open Cases" } }],  
                { rows: 200 });  
                
                
              // Create OnData listener for the table object.  
              var listener = function () {  
                debugger;  
                table.exportData({ download: false }, function (link) {  
                var url = (config.isSecure ? "https://" : "http://") + config.host + (config.port ? ":" + config.port : "") + link  
                window.open(url, "_blank");
                table.OnData.unbind(listener);  
                });  
              };  
                
                
              // Bind the listener to the table object.  
              table.OnData.bind(listener);