Skip to main content

Integration, Extension & APIs

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

Announcements
Skip the ticket, Chat with Qlik Support instead for instant assistance.
cancel
Showing results for 
Search instead for 
Did you mean: 
s29124141
Partner - Creator II
Partner - Creator 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 !!!

1 Solution

Accepted Solutions
s29124141
Partner - Creator II
Partner - Creator II
Author

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

View solution in original post

1 Reply
s29124141
Partner - Creator II
Partner - Creator II
Author

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