Qlik Community

Integration, Extension & APIs

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

Announcements
Qlik Insider: SaaS capabilities for Data Integration and Analytics, May 25th! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
mrchmchr
Contributor III
Contributor III

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.

1 Solution

Accepted Solutions
bgk
Employee
Employee

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

       }

  });

View solution in original post

1 Reply
bgk
Employee
Employee

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

       }

  });