1 Reply Latest reply: Jan 5, 2018 7:47 AM by Bhargav Patel RSS

    TypeError: Cannot read property 'qMatrix' of undefined

    Twee Wan Wong

      I am a new user on Qlik Sense Desktop version. To familiarize with the mashup, i create a mashup using

      HelpDesk Management App as base. I create  a List and added the list into the mashup.

      I have confirmed the app.createList function is there and i have edited the empty callback function to :

       

       

      //callbacks -- inserted here --

        function cbYear(reply, app){

            $("#divYear").empty();

          var qobject = reply.qListObject;

          console.log(qobject);  // <<===== I log this in console.

         

          $.each(qobject.qDataPages[0].qMatrix, function() {

              var item = this[0];

          var selT= "";

          console.log(item.qState);

         

          if (item.qState=="S") {

            selT=" style=\"backgroundcolor:black\"";

          }

              $("#divYear").append("<button type=checkbox " + selT + " class=\"btn btn-primary pull-right\">" + item.qText + "</button>")

            }) ;

        

        $("#divYear button").click( function() {

           app.field('Year').selectMatch($(this).text(),false);

        });

      }

       

      Strange thing is that the reply parameter returns no values of dimension "Year".

       

      1. Object {qSize: Object, qDimensionInfo: Object, qExpressions: Array(0), qDataPages: Array(0)}
        1. qDataPages:Array(0)
          1. length:0 <==== nothing gets return
          2. __proto__:Array(0)
        2. qDimensionInfo:Object
          1. qApprMaxGlyphCount:0
          2. qAttrDimInfo:Array(0)
          3. qAttrExprInfo:Array(0)

       

       

      And there is error in the browser console :

      TypeError: Cannot read property 'qMatrix' of undefined  <====== ERROR

          at cbYear (HelpDeskMashup.js:111)

          at a (qlik.js:84)

          at qlik.js:84

          at g (require.js:45)

          at require.js:45

       

       

      I search through google , but don't find anything useful on this.

      Anyone can help here ?

        • Re: TypeError: Cannot read property 'qMatrix' of undefined
          Bhargav Patel

          It's too late to answer it but instead of jquery functions you should use qlik inbuilt functions (i used it in extesion),


           

          app.getObject(objectId).then(function(e){
               
               // this block contains layout.qHyperCube 
               e.getHyperCubeData('/qHyperCubeDef', [{ 
                    qTop: 0,  
                    qLeft: 0,  
                    qWidth: 10,  
                    qHeight: 1000 
               }]).then(function(e){
                     //this block contains Array of qDataPages.
                     // perform process on data by accessing e[0].qMatrix[row][col]...
               }
          
          })
          
          

           

          Regards,

          bhargav patel