Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Andrey_Kosarev
Contributor II
Contributor II

Get child nodes of a specific node from a tree cube with getHyperCubeTreeData

Hi Everybody,

I am trying to implement a hierarchical drop down menu in the mashup using enigma js. To get the data I am using a session object of type 'tree' and 'getHyperCubeTreeData' method. 

The whole tree is quite large so I decided to extract it one level at a time (qDepth = 1) based on user's clicks (without selection). E.g. I only extract the children of the node that the user clicked.  

The problem I have is I can't quite get how do I specify the qArea to extract only a specific node's children. I was trying to get qArea limits from a selected parent but apparently something is wrong there, the function returns random (as it seems) parts of the cube, the whole field or an empty array. 

Could you please help me to specify the qArea parameter to get a specific node's children?

 

 

 

const hierarchyObject= {
    qInfo: {"qType": "tree-list"},
    qTreeDataDef: {
        qDimensions: [
            { qDef: {  qFieldDefs: ['=[Field1]'], qNullSuppression : true} },
            { qDef: {  qFieldDefs: ['=[Field2]'], qNullSuppression : true} },
            { qDef: {  qFieldDefs: ['=[Field3]'], qNullSuppression : true} },
            { qDef: {  qFieldDefs: ['=[Field4]'], qNullSuppression : true} },
            { qDef: {  qFieldDefs: ['=[Field5]'], qNullSuppression : true} },
            { qDef: {  qFieldDefs: ['=[Field6]'], qNullSuppression : true} },
            { qDef: {  qFieldDefs: ['=[Field7]'], qNullSuppression : true} },
        ],
        qInitialDataFetch: [{
            //qMaxNbrOfNodes: 100,
            qTreeLevels: { qDepth: 1, qLeft: 0},
            qTreeNodes: [{qArea: {qLeft: 1, qTop: 0, qWidth: 100, qHeight: 100}, }]
        }],
        qMode: 'DATA_MODE_TREE',
        qOpenFullyExpanded: true,
        qSuppressMissing: true,
        qAlwaysFullyExpanded:true
    }
}

 

 

 

async function drillDown(node) {
        console.log(node)
        let leftOffset  = node.qTreePath.length+1;
        let topOffset   = node.qGroupPos; 
        let batchHeight = node.qGroupSize  ;

        console.log(leftOffset, topOffset, batchHeight)
        let obj = await hierarchyObject;

        let treeData = await obj.getHyperCubeTreeData({
              qPath: `/qTreeDataDef`,
              qNodeOptions: {
                qMaxNbrOfNodes: 100000,
                qTreeLevels: { qDepth: 1, qLeft:  leftOffset},
                qTreeNodes: [ {qArea: {qLeft: 1, qTop: topOffset, qHeight: 1, qWidth: 1}}],
              },
            });

        console.log(treeData)
        
    }

 

 

Labels (4)
0 Replies