0 Replies Latest reply: Jan 25, 2017 4:18 AM by David Quinn RSS

    Timing issue: qMatrix height wrong immediately after toggleSelect?

    David Quinn



      I wonder if someone can help with this... In my extension I am using toggleSelect to select/deselect a dimension value, and then I check the layout.qHyperCube.qSize.qcy value to see the number of rows in the cube. The value I'm getting back *straight after* the toggleSelect is wrong (it is the value prior to the call). If I check again, without making any other selection calls, I get the correct value.


      I am using the following promise syntax on the toggleSelect in the hope that when the promise returns, the qMatrix will be correct:


      console.log("unselecting " +(i-1) + " , " + myArray[i-1] + ", Matrix height = " + $scope.layout.qHyperCube.qSize.qcy);

      var promise = app.field(dim).toggleSelect(myArray[i-1], true);

      promise.then(function(result) {

        console.log("toggle returned success:" + result);

        console.log("Matrix Height=" + $scope.layout.qHyperCube.qSize.qcy);



      }, function(result) {

        Alert("Failed to deselect data:" + result);


      } else {




      With 1 row selected prior to this code the console log looks like this:

      unselecting 1 , Feb-2013, Matrix height = 1

      animator.js??1481126454213:67 toggle returned success:true

      animator.js??1481126454213:68 Matrix Height=1

      Shortly after, querying the height will return the correct value (24).


      Am I doing something wrong in the code, or is there a better way? A promise method for qMatrix height for example?


      Thanks in advance,