Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi!
I want to display a master element metric in a mashup. To do this, I open the application via its ID, set a selection via field API and have the hypercube created.
Nevertheless, the hypercube contains significantly more elements, although only one element was selected by the selection.
Would someone be so kind and give me a hint why the hypercube is not updated to one element?
Many greetings!
Here an example:
/*
* Basic responsive mashup template
* @owner Enter you name here (xxx)
*/
/*
* Fill in host and port for Qlik engine
*/
var prefix = window.location.pathname.substr( 0, window.location.pathname.toLowerCase().lastIndexOf( "/extensions" ) + 1 );
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require.config( {
baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"
} );
require( ["js/qlik"], function ( qlik ) {
qlik.on( "error", function ( error ) {
$( '#popupText' ).append( error.message + "<br>" );
$( '#popup' ).fadeIn( 1000 );
} );
$( "#closePopup" ).click( function () {
$( '#popup' ).hide();
} );
//callbacks -- inserted here --
function myCB(reply, app){
console.log(reply);
// the hypercube has more than one element in its array.
}
//open apps -- inserted here --
var app = qlik.openApp('my-897f-app-a929-id', config);
var myField = app.field('myUserID').selectValues(['001'], true, true);
//get objects -- inserted here --
//create cubes and lists -- inserted here --
app.createCube({
"qInitialDataFetch": [
{
"qHeight": 20,
"qWidth": 2
}
],
"qDimensions": [
{
"qDef": {
"qFieldDefs": [
"#myDim1"
]
},
"qNullSuppression": true,
"qOtherTotalSpec": {
"qOtherMode": "OTHER_OFF",
"qSuppressOther": true,
"qOtherSortMode": "OTHER_SORT_DESCENDING",
"qOtherCounted": {
"qv": "5"
},
"qOtherLimitMode": "OTHER_GE_LIMIT"
}
}
],
"qMeasures": [
{
"qLabel": "myMeasure1",
"qLibraryId": "myMeasure1ID",
"qSortBy": {
"qSortByState": 0,
"qSortByFrequency": 0,
"qSortByNumeric": 0,
"qSortByAscii": 1,
"qSortByLoadOrder": 0,
"qSortByExpression": 0,
"qExpression": {
"qv": " "
}
}
}
],
"qSuppressZero": false,
"qSuppressMissing": false,
"qMode": "S",
"qInterColumnSortOrder": [],
"qStateName": "$"
},myCB);
} );
Hey! Please refer to this other post where a similar question was asked. Hope it helps
Thank you for your reply!
But unfortunately the solution from @Øystein_Kolsrud does not help (I also read it.)
I used and call already a callback function and nevertheless there is clearly more than only one array element in the hypercube.
But thank you very much for your reply @Chirantha !
Hi @MWerner could you please post what you are receiving from the hypercube and what are you expecting?