Qlik Community

Ask a Question

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
ak05
Partner
Partner

Engine API - Get Object layout for an Alternate Dimension

Performing Getlayout on an Object via the Engine API Explorer with the following request body

{
"handle": 2,
"method": "GetLayout",
"params": {}
}

returns the Object layout (from which  I can extract Measure data).

This particular Object though contains 'Alternative Dimensions'.

I would like to know - How can I query the Object layout by a given 'alternate' dimension (in my case, my base dimension is City, and my alternate dimension is State, I would like to query GetLayout by 'state' and not 'city')?

Anyone have any ideas on how to solve this?

 

Labels (1)
1 Reply
yko
Employee
Employee

I think the way the client solves this is by having a "container hypercube" in a property named "qLayoutExclude" under the hypercube for the relevant object.  The purpose of this hypercube is simply to store the available alternative dimensions. To activate a certain alternative, the client copies the dimension from the "container hypercube" to the real hypercube by modifying the properties of the object.

So in reality, there is no such thing as an "Alternative dimension" as far as the engine API goes. The way the client implements the functionality is to do on-the-fly modifications to the hypercube even though you're not in edit mode. This is very similar to what the client does when you for instance reorder the columns of a table. After doing so, next time you go to edit mode and click on such a table, you will get a message stating that the object has changed and whether you would like to keep those changes or not.

In the case of choosing alternative dimensions, this is the type of messages you will see in the websocket traffic when you choose a dimension for a bar chart:

{
   "delta":true,
   "handle":9,
   "method":"ApplyPatches",
   "params":[
      [
         {
            "qOp":"replace",
            "qValue":"[{\"qDef\":{\"qGrouping\":\"N\",\"qFieldDefs\":[\"Dim2\"]...,
            "qPath":"/qHyperCubeDef/qDimensions"
         },
         {
            "qOp":"replace",
            "qValue":"[{\"qDef\":{\"qGrouping\":\"N\",\"qFieldDefs\":[\"Dim1\"],...,
            "qPath":"/qHyperCubeDef/qLayoutExclude/qHyperCubeDef/qDimensions"
         }
      ],
      true
   ],
   "id":124,
   "jsonrpc":"2.0"
}