Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In a mashup I created I need the numerical field values for selection handling in js.
I am able to access a fields data via the getData() method. When inspecting the returned object I can find the qNum and qText values in the .rows element, but unfortunately I can not access them.
Is it possible to get these values via getData() or is there another way?
In particular I am interested in a dates numerical representation.
Guessing your issue here a little bit so bear with me.
When you write that you can't access them do you know if they are available when calling upon them? The getData() method will return them when a notification of OnData has been triggered
So to ensure that you get valid data you need to bind a listener on OnData the field. Example:
var data = qlikApp.field("the-field").getData();
data.OnData.bind(
function(){
var len = data.rows.length;
for (var i = 0; i < len; i++){
console.log(data.rows.qNum);
console.log(data.rows.qText);
}
});
Guessing your issue here a little bit so bear with me.
When you write that you can't access them do you know if they are available when calling upon them? The getData() method will return them when a notification of OnData has been triggered
So to ensure that you get valid data you need to bind a listener on OnData the field. Example:
var data = qlikApp.field("the-field").getData();
data.OnData.bind(
function(){
var len = data.rows.length;
for (var i = 0; i < len; i++){
console.log(data.rows.qNum);
console.log(data.rows.qText);
}
});