Skip to main content

Integration, Extension & APIs

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

Announcements
CUSTOMERS ONLY: Now accepting customer applications for the 2023 Luminary Program: SUBMIT NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Example of using exportData method

Hi,

Is someone able to help me with an example of how to use the exportData method, documented here:

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

I would like to create a button in my HTML mashup page, which exports the data held in a Qliksense table that has been embedded in the mashup page.

I can see from the code example it is simple to assign exportData method to the button. What I am struggling with initialising the qTable variable with the correct table object.

I am pulling the table into my mashup with the Javascript below, and the relevant div to be populated in the HTML has a data-qvid attribute where the objectID for the Qliksense object is populated.

var app = qlik.openApp( "myApp.qvf", config );

$( ".qvobject" ).each( function () {

          var qvid = $( this ).data( "qvid" );

          app.getObject( this, qvid ).then( function ( object ) {

                    qvobjects[qvid] = object;

          } );

     } );

So how do I then access the app variable I create above, to populate a new variable like the below using the relevant objectID:

var qTable = qlik.table(this);

1 Solution

Accepted Solutions
Alexander_Thor
Employee
Employee

app.getObject('objectid').then(function(model) {

var table = qlik.table(model);

table.exportData({download: true});

})

Here is a working sample Export Data - JSFiddle

It will say access denied when you try to export due to exporting being disabled fro anonymous users.

View solution in original post

8 Replies
Alexander_Thor
Employee
Employee

app.getObject('objectid').then(function(model) {

var table = qlik.table(model);

table.exportData({download: true});

})

Here is a working sample Export Data - JSFiddle

It will say access denied when you try to export due to exporting being disabled fro anonymous users.

datalakeyu
Specialist
Specialist

Hi Alexander, I use your method to export/download data from Qlik sense mashup table object.

However, I get "access denied" error.

Could you please tell how to configure in Qlik server to allow anonymous users export/download data from Qlik sense mashup page?

Thanks!

Alexander_Thor
Employee
Employee

Hey,

Anonymous users can't export data, if you want to allow exporting of content then you would need to authenticate them

datalakeyu
Specialist
Specialist

Hi Alexander, thanks so much for your help!

So, it means there are only two choices:

1: anonymous users, can not export/download data from Qlik sense mashup page

2: to be able to export/download data from Qlik mashup page, must have a user name/password from Qlik server,

is it right?

Is there any walk-around?


Alexander_Thor
Employee
Employee

There is no passwords in Qlik but ye that's the idea. Just authenticate the user hitting the page and exporting will work. It doesn't have to be a real user, just generate a random username

datalakeyu
Specialist
Specialist

Hi Alexander, thanks so much for your help!

Could you please help further explain the following two procedures?

1: Just authenticate the user hitting the page and exporting will work.

    How to authenticate the user hitting the page? Does it require the user having authentication to access the Qlik server (they are anonymous users)

2: It doesn't have to be a real user, just generate a random username

    How to generate a random username? Should I generate the random users in Qlik mashup or should I generate random user in Qlik server? If we generate the random user in Qlik server, how could the anonymous users to use it?

Could you please help explain the above questions in detail? If there is an example, that will be great.

Appreciate your time and help!

datalakeyu
Specialist
Specialist

Hi Alexander,

How to export data from Qlik sense mashup for Qlik sense anonymous users?

Qlik sense exportData and Table API only work for Qlik sense authorized users, but do not work for Qlik sense anonymous users.

However, the published Qlik sense mashup is public access WITHOUT Qlik sense user_id and password, how to make it to export data from Qlik sense mashup for Qlik sense anonymous user?

Thanks!

jitu2110
Creator
Creator

Hi, 

i want to cancel the request of ExportData() using Mashup API how can we do that ?