Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

fduchmann
New Contributor III

backendApi.selectValues on different HyperCube than layout.qHyperCube

Hello Qlik Community,

I try to send a Selection to the backendApi out of an Extension in Qlik Sense.

This works fine if I have only one HyperCube (the standard HyperCube, which can be reached with layout.qHyperCube).

If I have a second HyperCube defined and created, I have not found a way to send a Selection over this HyperCube to the Backend.

I tried to edit the backendApi settings such as dataPath and path with no luck.

Here some Code to explain my problem:

// Definition of the second HyperCube

var cubeDef = {

  qDimensions: [{

       qDef: {qFieldDefs: ["activity_id"] }

       },{

       qDef: {qFieldDefs:["case_id"]}

       }

   ],

  qInitialDataFetch: [{

      qTop: 0,

       qLeft: 0,

       qHeight: 100,

       qWidth: 2
   }]

};

// Creating the second HyperCube

var app = qlik.currApp();

app.createCube(cubeDef, function(q1){

     console.log("Native HyperCube", layout.qHyperCube);      // Access to native HC possible

     console.log("Second HyperCube", q1.qHyperCube);         // Access to new HC possible

     ....  some code for an Button    .....

     button.onclick=function(){

          var selection = [1];          // for tests this is hard-coded    

          _this.backendApi.selectValues(0,selection, false);           //this here works only with native HyperCube

     }                                                                                       // Note that _this is defined as this right after the paint function.

});

So with _this.backendApi.selectValues(0, selection, false)         0 is always the frist Dimension of the native HyperCube, but I would like to set reference 0 to the first Dimension of my own HyperCube.

Hope someone can help me.

Best regards

Frank

1 Solution

Accepted Solutions
erik_wetterberg
Honored Contributor

Re: backendApi.selectValues on different HyperCube than layout.qHyperCube

Hi Frank,

No you cant use the backendApi for this. The backendApi only wraps and simplifies access to some methods in the Generic Object thats behind your extension, and your second hypercube is not even in that Generic Object, since you create a new one.

Instead you can use the field api and the select method. A select for your case would be something like this:

app.field("activity_id").select([0,1,2],true,true);

Hope this helps

Erik

Erik Wetterberg
https://extendingqlik.upper88.com/
2 Replies
erik_wetterberg
Honored Contributor

Re: backendApi.selectValues on different HyperCube than layout.qHyperCube

Hi Frank,

No you cant use the backendApi for this. The backendApi only wraps and simplifies access to some methods in the Generic Object thats behind your extension, and your second hypercube is not even in that Generic Object, since you create a new one.

Instead you can use the field api and the select method. A select for your case would be something like this:

app.field("activity_id").select([0,1,2],true,true);

Hope this helps

Erik

Erik Wetterberg
https://extendingqlik.upper88.com/
fduchmann
New Contributor III

Re: backendApi.selectValues on different HyperCube than layout.qHyperCube

Hello Erik,

thank you very much for your reply.

I used the app.field("...").select and selectValues Method and it works perfectly.

Best regards

Frank

Community Browser