1 Reply Latest reply: Apr 3, 2017 7:37 AM by Jonas Hörström RSS

    Field API

    Lars Münzberg



      I try to use QlikSense Field API like this: select method ‒ Qlik Sense



      This is my  code:



      And this is the result in Development Console:



      The Problem is I can't  get acces to the rows Array.

      It is undefined, in row 251.


      If I print "console.log( fields.rows)" I get this:



      How can I get acces to the Array?

      The length is 0, seem like an error to me

        • Re: Field API
          Jonas Hörström



          You are most probably trying to access the data before it is available to you. The developer console provides this data when it is available giving you the possibility to drill down and investigate each row which can seem confusing sometimes. In the code you need to bind the field to a listener and work with the data when it has arrived. E.g.


          var data = qlikApp.field("the-field").getData();
          console.log(data); // Will show the data in develop console with rows its length etc
          console.log(data.rows.length); // will most probably show 0 since the data hasn't arrived yet
                 var len = data.rows.length;  
                 console.log(len); // will show the real size of rows since the data is available
                 for (var i = 0; i < len; i++){  
                      console.log(data.rows[i].qText + data.rows[i].qState);  // State flag (is the data selected or not)


          Hope it helps.