1. Create the variable Variable01. The identifier of the variable is VB01. A comment (in qComment) and a definition (in qDefinition) are set.
The client sends:
{
"jsonrpc": "2.0",
"id": 2,
"method": "CreateVariableEx",
"handle": 1,
"params": [
{
"qInfo": {
"qId": "VB01",
"qType": "Variable"
},
"qName": "Variable01",
"qComment": "My first variable",
"qDefinition": "=Count(Holes)"
}
]
}
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. Get the handle of the variable, by using the name of the variable (qName is Variable01). Check that the handle is 2.
The client sends:
{
"handle": 1,
"method": "GetVariableByName",
"params": {
"qName": "Variable01"
},
"id": 5,
"jsonrpc": "2.0"
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 5,
"result": {
"qReturn": {
"qType": "GenericVariable",
"qHandle": 2
}
}
}
The variable has 2 as a handle.