Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
frheblou
Contributor II
Contributor II

wait for callback function with getlist

Hello,

With little to no exprerience in JS i am trying to create a mashup to export master items from my apps as csv.
For that I am using something like, for example :

 

 

var strTest = "";

qApp.getList("DimensionList", function(reply){
$.each(reply.qDimensionList.qItems, function(key, value) {
strTest = strTest + '"' +
value.qInfo.qId + '";"' +
value.qMeta.title + '";"' +
value.qData.info[0].qName + '";"' +
value.qMeta.createdDate + '";"' +
value.qMeta.modifiedDate + '";"' +
value.qMeta.owner.userId + '";"' +
value.qMeta.description + '";"' +
value.qData.labelExpression + '";"' +
'' + '";"' +
'Dimension' + '"' + '\n';
});
});

/*
Export strTest instructions...
*/

 

 

 I also want to append to strTest the same thing for measures.
This works but the callback function is only run when data is received (a couple of seconds after my csv download instruction) , so I end up with an empty csv.

Could you tell me how I can adapt my code to wait for the callback function to run before exporting.

Thanks for your help

0 Replies