In this example, the hypercube contains one dimension: City and one measure: Sum(Quantity) * Sum(UnitPrice) * $(CurrencyConverter).
CurrencyConverter is a numeric variable whose initial value is 0.9.
This example shows how the data in the hypercube evolve when the value of the variable is changed.
1. Create the variableCurrencyConverter. The initial value is 0.9 and the identifier of the variable is VB01.
The client sends:
{
"jsonrpc": "2.0",
"id": 2,
"method": "CreateVariableEx",
"handle": 1,
"params": [
{
"qInfo": {
"qId": "VB01",
"qType": "Variable"
},
"qName": "CurrencyConverter",
"qDefinition": "0.90"
}
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"qReturn": {
"qType": "GenericVariable",
"qHandle": 2
},
"qInfo": {
"qId": "VB01",
"qType": "Variable"
}
},
"change": [
1,
2
]
}
The variable is created and has 2 as a handle.
2.Create a chart with one dimension (qFieldDefs is City) and one measure (qDef is "Quantity * UnitPrice * $(CurrencyConverter)").
The client sends:
{
"jsonrpc": "2.0",
"id": 3,
"method": "CreateSessionObject",
"handle": 1,
"params": [
{
"qInfo": {
"qId": "BC01",
"qType": "Chart"
},
"qHyperCubeDef": {
"qDimensions": [
{
"qLibraryId": "",
"qDef": {
"qFieldDefs": [
"City"
],
"qFieldLabels": [
"Label"
],
"qSortCriterias": [
{
"qSortByLoadOrder": 1
}
],
"qReverseSort": false
}
}
],
"qMeasures": [
{
"qLibraryId": "",
"qDef": {
"qLabel": "Chart HC Properties measures label",
"qDef": "Sum(UnitPrice)*Sum(Quantity)*$(CurrencyConverter)"
}
}
],
"qSuppressZero": true,
"qSuppressMissing": true,
"qInitialDataFetch": [
{
"qTop": 0,
"qHeight": 4,
"qLeft": 0,
"qWidth": 2
}
]
}
}
],
"cont": false,
"delta": false
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"qReturn": {
"qType": "GenericObject",
"qHandle": 3
}
},
"change": [
3
]
}
The chart is created. The handle of the chart is 3.
3. Get the layout of the chart. The handle of the request is 3 because the handle of the chart is 3.
The client sends:
{
"jsonrpc": "2.0",
"id": 4,
"method": "GetLayout",
"handle": 3,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 4,
"result": {
"qLayout": {
"qInfo": {
"qId": "BC01",
"qType": "Chart"
},
"qSelectionInfo": {},
"qHyperCube": {
"qSize": {
"qcx": 2,
"qcy": 11
},
"qDimensionInfo": [
{
"qFallbackTitle": "Label",
"qApprMaxGlyphCount": 14,
"qCardinal": 11,
"qSortIndicator": "A",
"qGroupFallbackTitles": [
"Label"
],
"qGroupPos": 0,
"qStateCounts": {
"qLocked": 0,
"qSelected": 0,
"qOption": 11,
"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": ","
},
"qIsAutoFormat": true,
"qGroupFieldDefs": [
"City"
]
}
],
"qMeasureInfo": [
{
"qFallbackTitle": "Chart HC Properties measures label",
"qApprMaxGlyphCount": 15,
"qCardinal": 0,
"qSortIndicator": "N",
"qNumFormat": {
"qType": "R",
"qnDec": 0,
"qUseThou": 0,
"qFmt": "##############",
"qDec": ",",
"qThou": " "
},
"qMin": 23430848494.625214,
"qMax": 3061107211344.6104,
"qIsAutoFormat": true,
"qAttrExprInfo": []
}
],
"qEffectiveInterColumnSortOrder": [
0,
1
],
"qGrandTotalRow": [
{
"qText": "26638214144658",
"qNum": 26638214144657.777,
"qElemNumber": -1,
"qState": "X",
"qIsTotalCell": true
}
],
"qDataPages": [
{
"qMatrix": [
[
{
"qText": "Berlin",
"qNum": "NaN",
"qElemNumber": 0,
"qState": "O"
},
{
"qText": "24383185575,125",
"qNum": 24383185575.125027,
"qElemNumber": 0,
"qState": "L"
}
],
[
{
"qText": "Mannheim",
"qNum": "NaN",
"qElemNumber": 1,
"qState": "O"
},
{
"qText": "27182641851,718",
"qNum": 27182641851.718,
"qElemNumber": 0,
"qState": "L"
}
],
[
{
"qText": "Aachen",
"qNum": "NaN",
"qElemNumber": 2,
"qState": "O"
},
{
"qText": "26113833067,574",
"qNum": 26113833067.574455,
"qElemNumber": 0,
"qState": "L"
}
],
[
{
"qText": "München",
"qNum": "NaN",
"qElemNumber": 3,
"qState": "O"
},
{
"qText": "332427570656,48",
"qNum": 332427570656.47638,
"qElemNumber": 0,
"qState": "L"
}
]
],
"qTails": [
{
"qUp": 0,
"qDown": 0
}
],
"qArea": {
"qLeft": 0,
"qTop": 0,
"qWidth": 2,
"qHeight": 4
}
}
],
"qPivotDataPages": [],
"qStackedDataPages": [],
"qMode": "S",
"qNoOfLeftDims": -1
}
}
}
}
The first fourth values are returned for both the dimension and the measure (qHeight is 4 and qWidth is 2). When the dimension value is Berlin, the value of the measure is 24383185575.125027.
4. Update the value of the variable, so that it is 2. The handle of the request is 2 because the handle of the variable is 2.
The client sends:
{
"jsonrpc": "2.0",
"id": 5,
"method": "SetNumValue",
"handle": 2,
"params": [
2
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 5,
"result": {},
"change": [
3
]
}
The variable CurrencyConverter has now for value 2.
5. Get the layout of the chart and check that the data are updated according to the new value of the variable.
The client sends:
{
"jsonrpc": "2.0",
"id": 6,
"method": "GetLayout",
"handle": 3,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 6,
"result": {
"qLayout": {
"qInfo": {
"qId": "BC01",
"qType": "Chart"
},
"qSelectionInfo": {},
"qHyperCube": {
"qSize": {
"qcx": 2,
"qcy": 11
},
"qDimensionInfo": [
{
"qFallbackTitle": "Label",
"qApprMaxGlyphCount": 14,
"qCardinal": 11,
"qSortIndicator": "A",
"qGroupFallbackTitles": [
"Label"
],
"qGroupPos": 0,
"qStateCounts": {
"qLocked": 0,
"qSelected": 0,
"qOption": 11,
"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": ","
},
"qIsAutoFormat": true,
"qGroupFieldDefs": [
"City"
]
}
],
"qMeasureInfo": [
{
"qFallbackTitle": "Chart HC Properties measures label",
"qApprMaxGlyphCount": 15,
"qCardinal": 0,
"qSortIndicator": "N",
"qNumFormat": {
"qType": "R",
"qnDec": 0,
"qUseThou": 0,
"qFmt": "##############",
"qDec": ",",
"qThou": " "
},
"qMin": 52068552210.278252,
"qMax": 6802460469654.6895,
"qIsAutoFormat": true,
"qAttrExprInfo": []
}
],
"qEffectiveInterColumnSortOrder": [
0,
1
],
"qGrandTotalRow": [
{
"qText": "59196031432573",
"qNum": 59196031432572.836,
"qElemNumber": -1,
"qState": "X",
"qIsTotalCell": true
}
],
"qDataPages": [
{
"qMatrix": [
[
{
"qText": "Berlin",
"qNum": "NaN",
"qElemNumber": 0,
"qState": "O"
},
{
"qText": "54184856833,611",
"qNum": 54184856833.611168,
"qElemNumber": 0,
"qState": "L"
}
],
[
{
"qText": "Mannheim",
"qNum": "NaN",
"qElemNumber": 1,
"qState": "O"
},
{
"qText": "60405870781,596",
"qNum": 60405870781.595551,
"qElemNumber": 0,
"qState": "L"
}
],
[
{
"qText": "Aachen",
"qNum": "NaN",
"qElemNumber": 2,
"qState": "O"
},
{
"qText": "58030740150,165",
"qNum": 58030740150.165459,
"qElemNumber": 0,
"qState": "L"
}
],
[
{
"qText": "München",
"qNum": "NaN",
"qElemNumber": 3,
"qState": "O"
},
{
"qText": "738727934792,17",
"qNum": 738727934792.16968,
"qElemNumber": 0,
"qState": "L"
}
]
],
"qTails": [
{
"qUp": 0,
"qDown": 0
}
],
"qArea": {
"qLeft": 0,
"qTop": 0,
"qWidth": 2,
"qHeight": 4
}
}
],
"qPivotDataPages": [],
"qStackedDataPages": [],
"qMode": "S",
"qNoOfLeftDims": -1
}
}
}
}
The data in the chart have changed. When the dimension value is Berlin, the value of the measure is now 54184856833.611168.