Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

mrchmchr
New Contributor II

How to get a fields numerical values

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.

Tags (4)
1 Solution

Accepted Solutions
bgk
New Contributor III

Re: How to get a fields numerical values

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

getData method ‒ Qlik Sense

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);

       }

  });

1 Reply
bgk
New Contributor III

Re: How to get a fields numerical values

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

getData method ‒ Qlik Sense

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);

       }

  });