1 Reply Latest reply: Apr 11, 2017 1:54 AM by praveena mundolimoole RSS

    ExportData issue : this.model.exportData is not a function

    praveena mundolimoole

      ExportData is failing with exception "this.model.exportData is not a function". Qlik Sense version 3.2.

       

      Note: ExportData is working for an existing object. Fails only for on the fly objects created in session.

       

      Tried various below examples, none seems to be working. Please help !!

       

      https://help.qlik.com/en-US/sense-developer/3.0/Subsystems/APIs/Content/TableAPI/exportData-method.htm

       

      https://community.qlikview.com/message/870871#870871

       

      <script>
              require(["js/qlik"], function (qlik) {
                  qlik.setOnError(function (error) {
                      alert(error.message);
                  });
      
      
                  var currentApp = qlik.openApp("6dcb2a8f-6d65-47fb-b5e9-6580df0b14ce", config);
      
      
                  currentApp.visualization.create('barchart', ["Case Owner Group", "=Avg([Case Duration Time])"], { "title": "On the fly barchart" })
                      .then(function (pivot) {
                          pivot.show('dynamicPivotChart');
                          var qTable = qlik.table(pivot);
                          qTable.exportData({ download: true });
                      });
              });
          </script>
      
      
      

       

      Hi, Alexander akl or jvs Could you please throw some light if ExportData is possible for on the fly objects (qlik visual or objetcs generated using visualization API)? I tried your example provided in above link, that works with no issues. Any help would be greatly appreciated !!!

        • Re: ExportData issue : this.model.exportData is not a function
          praveena mundolimoole

          Finally got it working using Table API. Below is the code.

           

          // 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");
            });
          };
          
          
          // Bind the listener to the table object.
          table.OnData.bind(listener);