8 Replies Latest reply: Dec 26, 2017 3:22 AM by Ilias Mansouri RSS

    Create hypercube for visualization in Qlik Engine Api

    Ilias Mansouri

      Hello all,

       

      Following this post: Add attribute expressions to a measure ‒ Qlik Sense Developers I'm trying to construct my own hypercube using the Sales Discovery app within the Qlik Engine API. I made a similar hypercube defIned like this:

       

      {
           "jsonrpc": "2.0",
           "id": 11,
           "method": "CreateSessionObject",
           "handle": 1,
           "params": [
                {
                     "qInfo": {
                          "qId": "",
                          "qType": "Chart"
                },
                "qHyperCubeDef": {
                     "qStateName": "$",
                     "qDimensions": [
                          {
                               "qLibraryId": "",
                               "qNullSuppression": false,
                               "qIncludeElemValue": false,
                               "qDef": {
                                    "qGrouping": "N",
                                    "qFieldDefs": [
                                    "Region"
                               ],
                               "qFieldLabels": [
                                    ""
                               ],
                               "qSortCriterias": [
                                    {
                                         "qSortByState": 0,
                                         "qSortByFrequency": 0,
                                         "qSortByNumeric": 0,
                                         "qSortByAscii": 0,
                                         "qSortByLoadOrder": 1,
                                         "qSortByExpression": 0,
                                         "qExpression": {
                                              "qv": ""
                                         }
                                    },
                                    {
                                         "qSortByState": 0,
                                         "qSortByFrequency": 0,
                                         "qSortByNumeric": 0,
                                         "qSortByAscii": 0,
                                         "qSortByLoadOrder": 1,
                                         "qSortByExpression": 0,
                                         "qExpression": {
                                              "qv": ""
                                         }
                                      }
                                    ]
                                 }
                               }
                          ],
                          "qMeasures": [
                               {
                                    "qLibraryId": "",
                                    "qSortBy": {
                                    "qSortByState": 0,
                                    "qSortByFrequency": 0,
                                    "qSortByNumeric": 0,
                                    "qSortByAscii": 0,
                                    "qSortByLoadOrder": 1,
                                    "qSortByExpression": 0,
                                    "qExpression": {
                                          "qv": ""
                                     }
                                 },
                                 "qDef": {
                                    "qLabel": "Chart HC Properties measures label",
                                    "qDescription": "Chart HC Properties measure description",
                                    "qTags": [
                                         "tags"
                                    ],
                                    "qGrouping": "N",
                                    "qDef": "Count(Sales)"
                               },
                               "qAttributeExpressions": [
                                    {
                                         "qExpression": "Max(Sales)"
                                    },
                                    {
                                         "qExpression": "'Mini:' & Min(Sales)"
                               }
                         ]
                     }
                 ]
             }
           }
         ]
      }
      

       

      Afterwards I try to aquire the Data with GetHypercubeData:

      {
            "handle": 4,
            "method": "GetHyperCubeData",
            "params": {
            "qPath": "/qHyperCubeDef",
            "qPages": [
                 {}
                 ]
            }
      }
      

       

      Finally, this is the response that I get:

      {     
           "jsonrpc": "2.0",
           "id": 14,
           "result": {
                "qDataPages": [
                     {
                          "qMatrix": [],
                          "qTails": [],
                          "qArea": {
                               "qLeft": 0,
                               "qTop": 0,
                               "qWidth": 0,
                               "qHeight": 0
                          }
                   }
                ]
            }
      }
      

       

       

      Can someone show me how to correctly build a cube and extract the data with Qlik Engine API using preferably the Customer Sales example? Due to restrictions, this should be implemented using JSON's so no other methods are allowed.

      Thanks in advance!