The first step is to create a chart with one dimension and one measure.
The app, used in this example, gives information about the golf courses in some countries.
1. Create the chart. The paging is composed of the first three lines (qHeight is 3) and first column (qWidth is 1) starting from the top left (qTop and qLeft are set to 0). The dimension is Country (qDimensions/0/qDef/qFieldDefs) and the sorting in the dimension is by ascending alphabetic order (qDimensions/qDef/qSortCriterias/qSortByAscii is 1). The measure is Sum(Holes) (in qMeasures/0/qDef/qDef).
The client sends:
{
"jsonrpc": "2.0",
"id": 1,
"method": "CreateSessionObject",
"handle": 1,
"params": [
{
"qInfo": {
"qId": "",
"qType": "Chart"
},
"qHyperCubeDef": {
"qStateName": "$",
"qDimensions": [
{
"qLibraryId": "",
"qNullSuppression": false,
"qIncludeElemValue": false,
"qDef": {
"qGrouping": "N",
"qFieldDefs": [
"Country"
],
"qFieldLabels": [
"Country label"
],
"qSortCriterias": [
{
"qSortByState": 0,
"qSortByFrequency": 0,
"qSortByNumeric": 0,
"qSortByAscii": 1,
"qSortByLoadOrder": 1,
"qSortByExpression": 0,
"qExpression": {
"qv": ""
}
},
{
"qSortByState": 0,
"qSortByFrequency": 0,
"qSortByNumeric": 0,
"qSortByAscii": 0,
"qSortByLoadOrder": 1,
"qSortByExpression": 0,
"qExpression": {
"qv": ""
}
}
],
"qNumberPresentations": [
{
"qType": "U",
"qnDec": 10,
"qUseThou": 0,
"qFmt": "",
"qDec": ".",
"qThou": " "
}
],
"qReverseSort": false
},
"qOtherTotalSpec": {
"qOtherMode": "OTHER_OFF",
"qOtherCounted": {
"qv": "10"
},
"qOtherLimit": {
"qv": "0.05"
},
"qOtherLimitMode": "OTHER_GT_LIMIT",
"qSuppressOther": false,
"qForceBadValueKeeping": true,
"qApplyEvenWhenPossiblyWrongResult": true,
"qGlobalOtherGrouping": false,
"qOtherCollapseInnerDimensions": false,
"qOtherSortMode": "OTHER_SORT_DESCENDING",
"qTotalMode": "TOTAL_OFF",
"qReferencedExpression": {
"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": "Sum(Holes)",
"qNumFormat": {
"qType": "U",
"qnDec": 10,
"qUseThou": 0,
"qFmt": "",
"qDec": ".",
"qThou": " "
},
"qRelative": false,
"qBrutalSum": false,
"qAggrFunc": "",
"qAccumulate": 0,
"qReverseSort": false
}
}
],
"qSuppressZero": false,
"qSuppressMissing": false,
"qInterColumnSortOrder": [],
"qInitialDataFetch": [
{
"qTop": 0,
"qLeft": 0,
"qHeight": 3,
"qWidth": 1
}
]
}
}
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"qReturn": {
"qType": "GenericObject",
"qHandle": 2
}
},
"change": [
2
]
}
The chart is created and its handle is 2.
2. Get the layout of the chart.
The client sends:
{
"jsonrpc": "2.0",
"id": 2,
"method": "GetLayout",
"handle": 2,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"qLayout": {
"qInfo": {
"qId": "bc30fc94-db32-4147-a4c2-9c9d1ff421ea",
"qType": "Chart"
},
"qSelectionInfo": {},
"qHyperCube": {
"qStateName": "$",
"qSize": {
"qcx": 2,
"qcy": 23
},
"qDimensionInfo": [
{
"qFallbackTitle": "Country label",
"qApprMaxGlyphCount": 14,
"qCardinal": 22,
"qSortIndicator": "A",
"qGroupFallbackTitles": [
"Country label"
],
"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"
]
}
],
"qMeasureInfo": [
{
"qFallbackTitle": "Chart HC Properties measures label",
"qApprMaxGlyphCount": 6,
"qCardinal": 0,
"qSortIndicator": "A",
"qNumFormat": {
"qType": "U",
"qnDec": 0,
"qUseThou": 0
},
"qMin": 0,
"qMax": 295317,
"qIsAutoFormat": true,
"qAttrExprInfo": []
}
],
"qEffectiveInterColumnSortOrder": [
0,
1
],
"qGrandTotalRow": [
{
"qText": "361716",
"qNum": 361716,
"qElemNumber": -1,
"qState": "X",
"qIsTotalCell": true
}
],
"qDataPages": [
{
"qMatrix": [
[
{
"qText": "Austria",
"qNum": "NaN",
"qElemNumber": 17,
"qState": "O"
}
],
[
{
"qText": "Belgium",
"qNum": "NaN",
"qElemNumber": 7,
"qState": "O"
}
],
[
{
"qText": "Canada",
"qNum": "NaN",
"qElemNumber": 3,
"qState": "O"
}
]
],
"qTails": [
{
"qUp": 0,
"qDown": 0
}
],
"qArea": {
"qLeft": 0,
"qTop": 0,
"qWidth": 1,
"qHeight": 3
}
}
],
"qPivotDataPages": [],
"qStackedDataPages": [],
"qMode": "S",
"qNoOfLeftDims": -1
}
}
}
}
The sorting order in the dimension is ascending.
3. Reverse the sort order (qReverseSort to true).
The client sends:
{
"jsonrpc": "2.0",
"id": 3,
"method": "ApplyPatches",
"handle": 2,
"params": [
[
{
"qPath": "/qHyperCubeDef/qDimensions/0/qDef/qReverseSort",
"qOp": "replace",
"qValue": "true"
}
]
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 3,
"result": {},
"change": [
2
]
}
4. Get the layout of the chart after the inversion of the sort order.
The client sends:
{
"jsonrpc": "2.0",
"id": 4,
"method": "GetLayout",
"handle": 2,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 4,
"result": {
"qLayout": {
"qInfo": {
"qId": "bc30fc94-db32-4147-a4c2-9c9d1ff421ea",
"qType": "Chart"
},
"qSelectionInfo": {},
"qHyperCube": {
"qStateName": "$",
"qSize": {
"qcx": 2,
"qcy": 23
},
"qDimensionInfo": [
{
"qFallbackTitle": "Country label",
"qApprMaxGlyphCount": 14,
"qCardinal": 22,
"qSortIndicator": "D",
"qGroupFallbackTitles": [
"Country label"
],
"qGroupPos": 0,
"qStateCounts": {
"qLocked": 0,
"qSelected": 0,
"qOption": 22,
"qDeselected": 0,
"qAlternative": 0,
"qExcluded": 0,
"qSelectedExcluded": 0,
"qLockedExcluded": 0
},
"qTags": [
"$ascii",
"$text"
],
"qDimensionType": "D",
"qReverseSort": true,
"qGrouping": "N",
"qNumFormat": {
"qType": "R",
"qnDec": 14,
"qUseThou": 1,
"qFmt": "##############",
"qDec": ".",
"qThou": ","
},
"qIsAutoFormat": true,
"qGroupFieldDefs": [
"Country"
]
}
],
"qMeasureInfo": [
{
"qFallbackTitle": "Chart HC Properties measures label",
"qApprMaxGlyphCount": 6,
"qCardinal": 0,
"qSortIndicator": "A",
"qNumFormat": {
"qType": "U",
"qnDec": 0,
"qUseThou": 0
},
"qMin": 0,
"qMax": 295317,
"qIsAutoFormat": true,
"qAttrExprInfo": []
}
],
"qEffectiveInterColumnSortOrder": [
0,
1
],
"qGrandTotalRow": [
{
"qText": "361716",
"qNum": 361716,
"qElemNumber": -1,
"qState": "X",
"qIsTotalCell": true
}
],
"qDataPages": [
{
"qMatrix": [
[
{
"qText": "United States",
"qNum": "NaN",
"qElemNumber": 0,
"qState": "O"
}
],
[
{
"qText": "United Kingdom",
"qNum": "NaN",
"qElemNumber": 8,
"qState": "O"
}
],
[
{
"qText": "Switzerland",
"qNum": "NaN",
"qElemNumber": 5,
"qState": "O"
}
]
],
"qTails": [
{
"qUp": 0,
"qDown": 0
}
],
"qArea": {
"qLeft": 0,
"qTop": 0,
"qWidth": 1,
"qHeight": 3
}
}
],
"qPivotDataPages": [],
"qStackedDataPages": [],
"qMode": "S",
"qNoOfLeftDims": -1
}
}
}
}
The sorting order in the dimension is now descending.