The app, used in this example, gives information about the golf courses in some countries.
1. The first step is to create a chart. The chart has one dimension Country (qFieldDefs is Country) and one measure Count(Holes) (qDef is Count(Holes)). This measure counts the number of golf course holes. Two attribute expressions related to the measure are added.
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": 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(Holes)"
},
"qAttributeExpressions": [
{
"qExpression": "Max(Holes)"
},
{
"qExpression": "'Mini:' & Min(Holes)"
}
]
}
],
"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 has 2 as a handle. The dimension is the field Country. The measure is the expression "Count(Holes)". Two attribute expressions are added to the measure: "Max(Holes)" and "'Mini:' & Min(Holes)".
2. Retrieve the values linked to the measure Count(Holes).
The client sends:
{
"jsonrpc": "2.0",
"id": 2,
"method": "GetHyperCubeData",
"handle": 2,
"params": [
"/qHyperCubeDef",
[
{
"qTop": 0,
"qLeft": 1,
"qHeight": 3,
"qWidth": 1
}
]
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"qDataPages": [
{
"qMatrix": [
[
{
"qText": "14521",
"qNum": 14521,
"qElemNumber": 0,
"qState": "L",
"qAttrExps": {
"qValues": [
{
"qNum": 1996
},
{
"qText": "Mini:0",
"qNum": "NaN"
}
]
}
}
],
[
{
"qText": "29",
"qNum": 29,
"qElemNumber": 0,
"qState": "L",
"qAttrExps": {
"qValues": [
{
"qNum": 45
},
{
"qText": "Mini:18",
"qNum": "NaN"
}
]
}
}
],
[
{
"qText": "130",
"qNum": 130,
"qElemNumber": 0,
"qState": "L",
"qAttrExps": {
"qValues": [
{
"qNum": 54
},
{
"qText": "Mini:9",
"qNum": "NaN"
}
]
}
}
]
],
"qTails": [
{
"qUp": 0,
"qDown": 0
}
],
"qArea": {
"qLeft": 1,
"qTop": 0,
"qWidth": 1,
"qHeight": 3
}
}
]
}
}
The values related to the attribute expressions are returned (in qAttrExps). For more information on the values returned, see GetHyperCubeData method.