Qlik sense enigma.js and Engine API – CreateSessionObject list Dimensions

The enigma.js function createSessionObject is used to create a list object. The definition of what the list object should contain is defined by a json structure and is passed as a parameter. This json structure varies depends on what you want to fetch.

Below is the definition to get the list of measures from an app

{
"qInfo": {
"qType": "DimensionList",
"qId": ""
},
"qDimensionListDef": {
"qType": "dimension",
"qData": {
"title": "/qMetaDef/title",
"tags": "/qMetaDef/tags",
"grouping": "/qDim/qGrouping",
"info": "/qDimInfos"
}
}
}

Example

qSession=enigma.create(config);
qSession.open().then((global) => {
qGlobal=global;

qGlobal.openDoc(app_id).then((app) => {
currApp=app;
currApp.createSessionObject(qParam).then(function(qObject){
console.log("created object");
qObject.getLayout().then(function(qProp){
res.json({msg:qProp.qDimensionList.qItems})
}, 
(e)=> {console.log(err);res.json(err)}); 

}
,(err)=>{ console.log(err);res.json(err)}) ;
})
},(err)=>{ console.log(err);res.json(err)})

 

Read blog post Qlik sense Enigmajs Create, Open session and list apps for more details on creating a session. For the complete list of enigma.j example follow theĀ Qlik sense Enigma.js Example Series posts