Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Qlik Sense Retrieve chart dimensions and measure information using Javascript
Hi everyone,
I am trying to retrieve the information of any type visualization using javascript
I'll appreciate some help on this.
Thanks:
Ajay Kakkar
Hi erik.wetterberg ,
i would love if you can give an example.?
The getProperties Will get you the charts properties, which includes inline mensurens and dimensions. IF the chart utses library dimensions and measures, you will need to make additional calls for those. I have written about that here:
https://extendingqlik.upper88.com/qlik-sense-generic-object-iv-the-lists/
Erik Wetterberg
Hi,
i managed to make this code(this codes works fine), but when i loop through it lot of objects are skipped in between...
var dim, mes, mstedim, mstrmes;
if (model.properties.qHyperCubeDef) {
// dim start
console.log('dim_' + objid, model.properties.qHyperCubeDef);
if (model.properties.qHyperCubeDef.qDimensions["0"]) {
$.each(model.properties.qHyperCubeDef.qDimensions, function(key, val) {
//console.log('dim_'+objid,val);
if (!val.qLibraryId == '' || !val.qLibraryId == "") {
//console.log('libdim_'+objid,getMasterDimById(app,val.qLibraryId));
dim = '<td>' + val.qLibraryId + '</td>';
} else if (!(val.qDef.qFieldDefs).length == 0) {
$.each(val.qDef.qFieldDefs, function(key1, val1) {
//console.log('dim_'+objid,val1);
dim = '<td>' + val1 + '</td>';
});
} else {
dim = '<td>No Dim</td>';
console.log('no dim');
}
});
} else {
dim = '<td>No Dim</td>';
}
// dim end
// mes start
//console.log(model.properties.qHyperCubeDef.qMeasures);
if (model.properties.qHyperCubeDef.qMeasures["0"]) {
$.each(model.properties.qHyperCubeDef.qMeasures, function(key, val) {
//console.log('mes_'+objid,val);
if (!val.qLibraryId == '' || !val.qLibraryId == "") {
//console.log('libmes_'+objid,val.qLibraryId,getMasterMesById(app,val.qLibraryId));
mes = '<td>' + val.qLibraryId + '</td>';
} else if (val.qDef.qDef) {
//console.log('mes_'+objid,val.qDef.qDef);
mes = '<td>' + val.qDef.qDef + '</td>';
} else {
mes = '<td>No Mes</td>';
console.log('no mes');
}
});
} else {
dim = '<td>No Mes</td>';
}
// mes end
var out = tabledata + '' + dim + '' + mes;
$('#drillObj').append(out + '</tr>');
}