Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
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