# Create a hypercube

Create a hypercube by using the [CreateChild method](https://help.qlik.com/en-US/sense-developer/November2024/Subsystems/EngineJSONAPI/Content/service-genericobject-createchild.htm).

Information noteA child must be part of an app level object (for example, a sheet or a story).

Create a transient hypercube by using the [CreateSessionObject method](https://help.qlik.com/en-US/sense-developer/November2024/Subsystems/EngineJSONAPI/Content/service-doc-createsessionobject.htm).

## Example

[](https://help.qlik.com/en-US/sense-developer/Subsystems/EngineAPI/Content/Sense_EngineAPI/WorkingWithAppsAndVisualizations/CreateVisualizations/create-hypercube.htm)

#### The goal is to create a hypercube with two dimensions and one measure. The hypercube is a child of the sheet SH01.

1. Create a sheet SH01 (qId is Sheet01). The handle of the request is 1 because the [CreateObject method](https://help.qlik.com/en-US/sense-developer/November2024/Subsystems/EngineJSONAPI/Content/service-doc-createobject.htm) applies at app level.

The client sends:

```
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "CreateObject",
  "handle": 1,
  "params": [
    {
      "title": "Sheet 1",
      "description": "Description of sheet 1",
      "qInfo": {
        "qId": "Sheet01",
        "qType": "sheet"
      },
      "qChildListDef": {
        "qData": {
          "title": "/title",
          "description": "/description",
          "meta": "/meta",
          "order": "/order",
          "type": "/qInfo/qType",
          "id": "/qInfo/qId",
          "lb": "/qListObjectDef",
          "hc": "/qHyperCubeDef"
        }
      }
    }
  ]
}
```

The engine returns:

```
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "qReturn": {
      "qType": "GenericObject",
      "qHandle": 2
    },
    "qInfo": {
      "qId": "Sheet01",
      "qType": "sheet"
    }
  },
  "change": [
    2
  ]
}
```

The sheet SH01 is created. The handle of the sheet is 2.

2. Create a bar chart BarChart01 (qId is BarChart01) in the sheet. The handle of the request is 2 because the sheet has 2 as a handle. The bar chart has two dimensions Country and City (set in qFieldDefs) and one measure (qDef is Count(Holes)).

The client sends:

```
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "CreateChild",
  "handle": 2,
  "params": [
    {
      "qInfo": {
        "qId": "BarChart01",
        "qType": "Chart"
      },
      "qHyperCubeDef": {
        "qStateName": "$",
        "qDimensions": [
          {
            "qLibraryId": "",
            "qNullSuppression": false,
            "qDef": {
              "qGrouping": "N",
              "qFieldDefs": [
                "Country"
              ],
              "qFieldLabels": [
                ""
              ]
            }
          },
          {
            "qLibraryId": "",
            "qNullSuppression": false,
            "qDef": {
              "qGrouping": "N",
              "qFieldDefs": [
                "City"
              ],
              "qFieldLabels": [
                ""
              ]
            }
          }
        ],
        "qMeasures": [
          {
            "qLibraryId": "",
            "qSortBy": {
              "qSortByState": 0,
              "qSortByFrequency": 0,
              "qSortByNumeric": 0,
              "qSortByAscii": 0,
              "qSortByLoadOrder": 1,
              "qSortByExpression": 0,
              "qExpression": {
                "qv": ""
              }
            },
            "qDef": {
              "qLabel": "",
              "qDescription": "",
              "qTags": [
                "tags"
              ],
              "qGrouping": "N",
              "qDef": "=Count(Holes)"
            }
          }
        ],
        "qInitialDataFetch": [
          {
            "qTop": 0,
            "qLeft": 0,
            "qHeight": 2,
            "qWidth": 3
          },
          {
            "qTop": 0,
            "qLeft": 0,
            "qHeight": 0,
            "qWidth": 0
          },
          {
            "qTop": 0,
            "qLeft": 0,
            "qHeight": 0,
            "qWidth": 0
          }
        ]
      }
    }
  ]
}
```

The engine returns:

```
{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "qReturn": {
      "qType": "GenericObject",
      "qHandle": 3
    },
    "qInfo": {
      "qId": "BarChart01",
      "qType": "Chart"
    }
  },
  "change": [
    3
  ]
}
```

The bar chart is created inside the sheet. The handle of the bar chart is 3.

3. Get the layout of the bar chart.

The client sends:

```
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "GetLayout",
  "handle": 3,
  "params": []
}
```

The engine returns:

{ "jsonrpc": "2.0", "id": 3, "result": { "qLayout": { "qInfo": { "qId": "BarChart01", "qType": "Chart" }, "qSelectionInfo": {}, "qHyperCube": { "qStateName": "$", "qSize": { "qcx": 3, "qcy": 7758 }, "qDimensionInfo": [ { "qFallbackTitle": "Country", "qApprMaxGlyphCount": 14, "qCardinal": 22, "qSortIndicator": "N", "qGroupFallbackTitles": [ "Country" ], "qGroupPos": 0, "qStateCounts": { "qLocked": 0, "qSelected": 0, "qOption": 22, "qDeselected": 0, "qAlternative": 0, "qExcluded": 0, "qSelectedExcluded": 0, "qLockedExcluded": 0 }, "qTags": [ "$ascii", "$text" ], "qDimensionType": "D", "qGrouping": "N", "qNumFormat": { "qType": "R", "qnDec": 14, "qUseThou": 1, "qFmt": "##############", "qDec": ".", "qThou": "," }, "qIsAutoFormat": true, "qGroupFieldDefs": [ "Country" ] }, { "qFallbackTitle": "City", "qApprMaxGlyphCount": 30, "qCardinal": 7532, "qSortIndicator": "N", "qGroupFallbackTitles": [ "City" ], "qGroupPos": 0, "qStateCounts": { "qLocked": 0, "qSelected": 0, "qOption": 7532, "qDeselected": 0, "qAlternative": 0, "qExcluded": 0, "qSelectedExcluded": 0, "qLockedExcluded": 0 }, "qTags": [ "$text" ], "qDimensionType": "D", "qGrouping": "N", "qNumFormat": { "qType": "R", "qnDec": 14, "qUseThou": 1, "qFmt": "##############", "qDec": ".", "qThou": "," }, "qIsAutoFormat": true, "qGroupFieldDefs": [ "City" ] } ], "qMeasureInfo": [ { "qFallbackTitle": "=Count(Holes)", "qApprMaxGlyphCount": 5, "qCardinal": 0, "qSortIndicator": "A", "qNumFormat": { "qType": "I", "qnDec": 0, "qUseThou": 1, "qFmt": "###0", "qDec": "." }, "qMin": 0, "qMax": 74, "qIsAutoFormat": true, "qAttrExprInfo": [] } ], "qEffectiveInterColumnSortOrder": [ 0, 1, 2 ], "qGrandTotalRow": [ { "qText": "17891", "qNum": 17891, "qElemNumber": -1, "qState": "X", "qIsTotalCell": true } ], "qDataPages": [ { "qMatrix": [ [ { "qText": "United States", "qNum": "NaN", "qElemNumber": 0, "qState": "O" }, { "qText": "Addison", "qNum": "NaN", "qElemNumber": 0, "qState": "O" }, { "qText": "3", "qNum": 3, "qElemNumber": 0, "qState": "L" } ], [ { "qText": "United States", "qNum": "NaN", "qElemNumber": 0, "qState": "O" }, { "qText": "Ivyland", "qNum": "NaN", "qElemNumber": 1, "qState": "O" }, { "qText": "1", "qNum": 1, "qElemNumber": 0, "qState": "L" } ] ], "qTails": [ { "qUp": 101, "qDown": 0 }, { "qUp": 0, "qDown": 0 } ], "qArea": { "qLeft": 0, "qTop": 0, "qWidth": 3, "qHeight": 2 } }, { "qMatrix": [], "qTails": [], "qArea": { "qLeft": 0, "qTop": 0, "qWidth": 0, "qHeight": 0 } }, { "qMatrix": [], "qTails": [], "qArea": { "qLeft": 0, "qTop": 0, "qWidth": 0, "qHeight": 0 } } ], "qPivotDataPages": [], "qStackedDataPages": [], "qMode": "S", "qNoOfLeftDims": -1 } } } }

As defined in qInitialDataFetch, the first two values related to the dimension Country are displayed.