Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

s29124141
Contributor II

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

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.h...

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 !!!

Tags (2)
1 Solution

Accepted Solutions
s29124141
Contributor II

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

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

1 Reply
s29124141
Contributor II

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

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

Community Browser