A preliminary step is to create a transient list object.
The method used in this example to update the properties is ApplyPatches method.
1. Create a transient list object.
The client sends:
{
"jsonrpc": "2.0",
"id": 1,
"method": "CreateSessionObject",
"handle": 1,
"params": [
{
"qInfo": {
"qId": "LB01",
"qType": "ListObject"
},
"qListObjectDef": {
"qStateName": "$",
"qLibraryId": "",
"qDef": {
"qFieldDefs": [
"Country"
],
"qFieldLabels": [
"Country Label"
],
"qSortCriterias": [
{
"qSortByLoadOrder": 1
}
]
},
"qInitialDataFetch": [
{
"qTop": 0,
"qHeight": 1,
"qLeft": 0,
"qWidth": 1
}
]
},
"title": "Title for LB01"
}
]
}
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. Update two properties from the list object.
The updated properties are persistent (qSoftPatch is set to the default value false).
The client sends:
{
"jsonrpc": "2.0",
"id": 2,
"method": "ApplyPatches",
"handle": 2,
"params": [
[
{
"qPath": "/qListObjectDef/qDef/qSortCriterias/0/qSortByLoadOrder",
"qOp": "replace",
"qValue": "-1"
},
{
"qPath": "/meta",
"qOp": "add",
"qValue": "{ \"data\": \"this is the data\"}"
}
]
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 2,
"result": {},
"change": [
2
]
}
The property SortByLoadOrder is updated and the property meta is added.
3. Get the properties of the list object.
Since the updated properties are persistent, the GetProperties method can be used to retrieve the properties of the list object.
The client sends:
{
"jsonrpc": "2.0",
"id": 3,
"method": "GetProperties",
"handle": 2,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"qProp": {
"qInfo": {
"qId": "LB01",
"qType": "ListObject"
},
"qMetaDef": {},
"qListObjectDef": {
"qStateName": "$",
"qDef": {
"qGrouping": "N",
"qFieldDefs": [
"Country"
],
"qFieldLabels": [
"Country Label"
],
"qSortCriterias": [
{
"qSortByLoadOrder": -1,
"qExpression": {}
}
],
"qNumberPresentations": []
},
"qFrequencyMode": "N",
"qInitialDataFetch": [
{
"qLeft": 0,
"qTop": 0,
"qWidth": 1,
"qHeight": 1
}
],
"qExpressions": []
},
"title": "Title for LB01",
"meta": {
"data": "this is the data"
}
}
}
}
The two properties have been updated.