Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone. I am new to creating mash ups and was wondering if I could get a solution to a issue I have come across.
I created a mashup using Qlik Sense Server Workbench. This mashup contains a table object from one of the sheets in my app. When accessing the sheet via the HUB, right clicking on the table shows an Export Data option for this table object. Is there a way for me to include this feature for this table in my mashup?
Thanks!
Hi,
here's an example how you could do that. This functionality is currently not documented nor supported, but in the next version of Qlik Sense it will be there:
Html:
<button id="cmdExport" style="display:none;">
Export data
</button>
<div id="QV01" style="position: absolute; top: 50px; left: 20px; width: 200px; height: 200px;" class="qvobject"></div>
JavaScript:
require( ["js/qlik", "jquery"], function ( qlik, $ ) {
qlik.setOnError( function ( error ) {
alert( error.message );
} );
var app = qlik.openApp('Executive Dashboard.qvf', config);
app.getObject('QV01','NaKQwM').then( function( vizModel ) {
// Prevent clicking on the button too early
$('#cmdExport').show();
$('#cmdExport').on('click', function() {
vizModel.exportData().then(function( reply ) {
console.log('qUrl', reply);
window.open(reply.result.qUrl);
});
})
});
} );
Teena,
Have a look at the Engine API. In particular, this link here: http://help.qlik.com/sense/en-us/developer/#../Subsystems/EngineAPI/Content/WorkingWithAppsAndVisual...
Basically, you can create a hypercube (potentially hook into the hypercube of the object) and export the data from there.
Hi Jeffrey,
Can you make an example? It will be great to share it.
aiham
Hi Jeffrey,
Can you please provide an example for mashup content here? We need this feature to make mashups more useful.
Ramendra
Hi,
here's an example how you could do that. This functionality is currently not documented nor supported, but in the next version of Qlik Sense it will be there:
Html:
<button id="cmdExport" style="display:none;">
Export data
</button>
<div id="QV01" style="position: absolute; top: 50px; left: 20px; width: 200px; height: 200px;" class="qvobject"></div>
JavaScript:
require( ["js/qlik", "jquery"], function ( qlik, $ ) {
qlik.setOnError( function ( error ) {
alert( error.message );
} );
var app = qlik.openApp('Executive Dashboard.qvf', config);
app.getObject('QV01','NaKQwM').then( function( vizModel ) {
// Prevent clicking on the button too early
$('#cmdExport').show();
$('#cmdExport').on('click', function() {
vizModel.exportData().then(function( reply ) {
console.log('qUrl', reply);
window.open(reply.result.qUrl);
});
})
});
} );
Hi,
Please what is vizModel?
It is the model of the visualization object.
Okay, thanks. I tried to follow your example, but it didn't work. Please what am I doing wrong?
As mentioned before, the above illustrated solution is not officially supported.
Starting with Qlik Sense 2.1 (which will be available soon) a new Client API will be available the so called "Table API" which then allows export of data:
var qTable = qlik.table(this);
var $exportButton = $( document.createElement('button'));
$exportButton.html('Export');
$exportButton.bind('click', function ( ) {
qTable.exportData({download: true});
});
$element.append($exportButton);
More about the Table API will then be available in the official documentation of Qlik Sense 2.1
Oh, now I understand you, so it can't work yet until version 2.1? We will wait till then. However am I on the right path from the code I posted.