7 Replies Latest reply: Nov 10, 2017 9:10 AM by Francis Kabinoff RSS

    Hypercube callback after every selection

    Thomas Pessato

      Hello all,

       

      I'm creating a mashup using hypercube.

       

      I'm trying to use a hypercube to get value 'Year', from a expression using the Qlik Engine. After that, I want to make an automatic selection on the field 'Year'.


      So ok, my hypercube is working and calling my callback function. Then I set my selection on the right field. And it works.


      But I realized that the callback function keeps getting called after every selection made on the mashup. Since my data doesn't change, I don't want it to happen. It's unecessary.

       

       

      I managed this issue by:

       

      1. Placing a flag like:

       

      var hypercubeDone = false;

      function callback(reply, app) {

              if(hypercube) {

                    return;

                }

              // do some stuff

              hypercubeDone = true;
      }

       

      in my JavaScript file.

      But that doesn't solve my problem of calling this method multiple times. So I tried another solution...

       

      2. Destroying the hypercube after the call:

       

      But don't know if this is a good practice. So I tried to find another way.

       

       

       

      I don't want this to happen, since it is not necessary. Is there a right way to prevent this?

       

       

      Thanks!!