Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am writing a mashup that needs to retrieve two values from a single row straight table, as illustrated below. In one variable I would want the value 22333 and in the second variable 33222.
What is the JS to accomplish this?
You can calculate the two values directly with two variables without using Javascript at all.
You'll have to make use of the Aggr function which can help you grouping over the necessary dimensions and the first parameter will be the expression with an aggregation function that you want to calculate:
vVariableA=Aggr( Sum( {<Year={2017},Country={'Tinystan'}>} Something ) , Year , Country )
I am looking for a mashup solution to retrieve the data points. The straight table will incorporate any needed aggregations. The standard mashup solution to retrieve the visualization object is similar to the Js code shown below. Rather than retrieving the object, I want to retrieve the values in the straight table.
var app = qlik.openApp('50fa200c-9d3b-4048-ac1e-573af8cdd11f', config);
//get objects -- inserted here --
app.getObject('QV04','xwjwJm');
app.getObject('QV03','XYThZn');
app.getObject('QV02','vpFgFAg');
app.getObject('QV01','phfXmU');
Hi,
You could use the createCube method in the API. I assume there are som formulas behind the values in your example, just provide them as measures and you will get a small hypercube back with the actual values.
Erik Wetterberg
The following code retrieves the object model.
var app = qlik.openApp('e968b99c-595f-4106-8e78-9498b96ddd6e', config);
//get objects -- inserted here --
app.getObject('QV01','RMgxzbF').then(model => {
console.log('a: ',model.layout.qHyperCube.qSize);
model.getHyperCubeData('/qHyperCubeDef', [{
qTop: 0,
qLeft: 0,
qwidth: 2,
qHeight: 10
}]).then(data => console.log('b: ',data))
});
I can see the data points in the console. How do I retrieve the data points to two different variables?
HI,
something like:
var row = data[0].qMatrix[0];
var x1 = row[0].qNum;
etc....
Erik
Thank you very much for your help. I am pretty new to Javascript and it is not clear to me where I would place your suggested code to retrieve the values.
Try the place where you log the data today.
you could use variable.setStringValue method to assign value into script variable :
app.variable.setStringValue("variable", value);