Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to get unique values for current field in extension. That's what I do:
var data = qlik.currApp().field(value.qGroupFieldDefs[0].toString()).getData();
var listener = function () {
$.each(this.rows, function(idx, row) {
// do smth
})
data.OnData.unbind(listener);
};
data.OnData.bind(listener);
});
I have this extension on several sheets. When i first time open app this works well, but when i go to another page, this extension give me the following error:
TypeError: this.genericObject.close is not a function
at e.getData (client.js??1497008912700:66)
at filterTree.js??1497008912700:65 <-------that is my extension
at Array.forEach (<anonymous>)
at buildTree (filterTree.js??1497008912700:62)
at Object.<anonymous> (filterTree.js??1497008912700:35)
at client.js??1497008912700:3
at Array.forEach (<anonymous>)
at a.emit (client.js??1497008912700:3)
at Object.setState (client.js??1497008912700:18)
at client.js??1497008912700:18
I have checked the Table API and found the way to solve my problem. The answer is to create different table(hypercube) for each dimension in extension. Here is code
var dim = [value.qGroupFieldDefs[0].toString()];
var fltr = qlik.currApp().createTable(dim, [], {rows:200});
var listener = function () {
$.each(fltr.qHyperCube.qDataPages[0].qMatrix, function(idx, row) {
//do smth
})
}
fltr.OnData.bind(listener)
});
Thank you Rikard!
Hi Ilya!
The problem you describe is a known issue to us and we are looking into it.
Looking at what you are trying to achieve, it feels like that you might be able to use the Table API instead to solve your problem. With the table API you will be able to get information from all the fields that are tied to your extension. The information you get back is also automatically updated when you make selections in your app. Look at the QTable specifically. QTable ‒ Qlik Sense
Hopefully you can find a workaround using qTable instead.
Regards Rikard
Hi Rikard!
Thank you for your response. My extension is filter panel with about a 20 dimensions to filter. Some of them are variables. So I would like to get unique values for each dimension with qElemNumber for filtering. As I understand, trying to get all data for each dimension and then get unique - is not an option, because of an amount of data.
I'll try to use Table API. I will write back about results.
I have checked the Table API and found the way to solve my problem. The answer is to create different table(hypercube) for each dimension in extension. Here is code
var dim = [value.qGroupFieldDefs[0].toString()];
var fltr = qlik.currApp().createTable(dim, [], {rows:200});
var listener = function () {
$.each(fltr.qHyperCube.qDataPages[0].qMatrix, function(idx, row) {
//do smth
})
}
fltr.OnData.bind(listener)
});
Thank you Rikard!
It's unfortinate that you had to do this workaround but I'm happy you found a solution. Thanks for posting your solution as it might help others with the same problem.