This example begins with the creation of a list object. Some values are selected in the list object and a back action is performed. The number of entries in the back and forward stacks are retrieved. Then a forward action and a clear of all selections are performed. The number of entries in the back and forward stacks are retrieved .
1.Create a list object with the dimension (qFieldDefs) Country. The initial data fetch is composed of the first three values (qTop is 0 and qHeight is 3).
The client sends:
{
"jsonrpc": "2.0",
"id": 1,
"method": "CreateSessionObject",
"handle": 1,
"params": [
{
"qInfo": {
"qId": "",
"qType": "ListObject"
},
"qListObjectDef": {
"qStateName": "$",
"qLibraryId": "",
"qDef": {
"qFieldDefs": [
"Country"
],
"qFieldLabels": [
"Country Label"
],
"qSortCriterias": [
{
"qSortByLoadOrder": 1
}
]
},
"qInitialDataFetch": [
{
"qTop": 0,
"qHeight": 3,
"qLeft": 0,
"qWidth": 1
}
]
}
}
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"qReturn": {
"qType": "GenericObject",
"qHandle": 2
}
},
"change": [
2
]
}
The list object is created and the handle is 2.
2.Select the first two values of the list object (qValues is 0 and 1).
The client sends:
{
"jsonrpc": "2.0",
"id": 2,
"method": "SelectListObjectValues",
"handle": 2,
"params": [
"/qListObjectDef",
[
0,
1
],
false
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"qSuccess": true
},
"change": [
2
]
}
The selections are successful.
3.Go backward.
The client sends:
{
"jsonrpc": "2.0",
"id": 3,
"method": "Back",
"handle": 1,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 3,
"result": {}
}
4.Get the number of entries in the back stack.
The client sends:
{
"jsonrpc": "2.0",
"id": 4,
"method": "BackCount",
"handle": 1,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 4,
"result": {
"qReturn": 0
}
}
The number of entries in the back stack is 0.
5.Get the number of entries in the forward stack.
The client sends:
{
"jsonrpc": "2.0",
"id": 5,
"method": "ForwardCount",
"handle": 1,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 5,
"result": {
"qReturn": 1
}
}
The number of entries in the forward stack is 1.
6.Go forward.
The client sends:
{
"jsonrpc": "2.0",
"id": 6,
"method": "Forward",
"handle": 1,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 6,
"result": {},
"change": [
1
]
}
7.Get the number of entries in the back stack.
The client sends:
{
"jsonrpc": "2.0",
"id": 7,
"method": "BackCount",
"handle": 1,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 7,
"result": {
"qReturn": 1
}
}
The number of entries in the back stack is 1.
8.Get the number of entries in the forward stack.
The client sends:
{
"jsonrpc": "2.0",
"id": 8,
"method": "ForwardCount",
"handle": 1,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 8,
"result": {
"qReturn": 0
}
}
The number of entries in the forward stack is 0.
9.Clear all selections.
The client sends:
{
"jsonrpc": "2.0",
"id": 9,
"method": "ClearAll",
"handle": 1,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 9,
"result": {},
"change": [
1
]
}
The selections are cleared.
10.Get the number of entries in the back stack.
The client sends:
{
"jsonrpc": "2.0",
"id": 10,
"method": "BackCount",
"handle": 1,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 10,
"result": {
"qReturn": 2
}
}
The number of entries in the back stack is 2.
11.Get the number of entries in the forward stack.
The client sends:
{
"jsonrpc": "2.0",
"id": 11,
"method": "ForwardCount",
"handle": 1,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 11,
"result": {
"qReturn": 0
}
}
The number of entries in the forward stack is 0.