Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Need one help.
Can we export data from container object {container object has 3 tables in it} using mashup API? Currently I am not able to do so for 3 tables with in a container .
For a single objects below function is working like pie chart , single table or any chart that is not part of container object but not working for tables / or any other charts that are part of a container object.
Function used is
exportdatas('chart1','wdmg')
//here wdmg is object id of container.
function exportdatas(divid,objectid){
app.getObject(divid,objectid).then(function(model){
var d = app.table(model);
d.exportData({'format':'CSV_C','state':'A','filename': 'exportdata.csv','download': true})
});
}
Please help on this.
Hi @Qlik1_User1 , after you get the container object, you have to read which objects is containing. Then you have to perform a new getObject call pointing to the table you want to export. I usually use Engine APIs from Capability APis for doing this. Below an example:
//Wait Engine API promise
const promise = await app.model.waitForOpen.promise
//Get container object
const container = await app.model.enigmaModel.getObject('_yourContainerObjectId_');
//Get container layout for reading container children
const containerLayout = await container.getLayout();
//Get as an example the first children and then export its data (you should loop over children and do your stuff)
const chartOne = await app.model.enigmaModel.getObject(containerLayout.children[0].refId);
//Define export type as CSV
const exportDef = {
"qFileType": "CSV_C",
"qPath": "/qHyperCubeDef",
"qExportState": 0,
"qServeOnce": false
};
const exportData = await chartOne.exportData(exportDef);
//Print export url
console.log(exportData.qUrl)
Hi @Qlik1_User1 , after you get the container object, you have to read which objects is containing. Then you have to perform a new getObject call pointing to the table you want to export. I usually use Engine APIs from Capability APis for doing this. Below an example:
//Wait Engine API promise
const promise = await app.model.waitForOpen.promise
//Get container object
const container = await app.model.enigmaModel.getObject('_yourContainerObjectId_');
//Get container layout for reading container children
const containerLayout = await container.getLayout();
//Get as an example the first children and then export its data (you should loop over children and do your stuff)
const chartOne = await app.model.enigmaModel.getObject(containerLayout.children[0].refId);
//Define export type as CSV
const exportDef = {
"qFileType": "CSV_C",
"qPath": "/qHyperCubeDef",
"qExportState": 0,
"qServeOnce": false
};
const exportData = await chartOne.exportData(exportDef);
//Print export url
console.log(exportData.qUrl)