Search for a string in a list object
Search for a string in a list object by using the SearchListObjectFor method.
Example
1. Create a list object.
The client sends:
{
"jsonrpc": "2.0",
"id": 1,
"method": "CreateSessionObject",
"handle": 1,
"params": [
{
"qInfo": {
"qId": "ListObject01",
"qType": "ListObject"
},
"qListObjectDef": {
"qStateName": "$",
"qLibraryId": "",
"qDef": {
"qFieldDefs": [
"Country"
],
"qFieldLabels": [
"Country Label"
],
"qSortCriterias": [
{
"qSortByLoadOrder": 1
}
]
},
"qInitialDataFetch": [
{
"qTop": 0,
"qHeight": 14,
"qLeft": 0,
"qWidth": 1
}
],
"qShowAlternatives": true
}
}
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"qReturn": {
"qType": "GenericObject",
"qHandle": 2
}
},
"change": [
2
]
}
The list object is created and its handle is 2. It contains a list of countries.
2. Search for all values that start with P.
The client sends:
{
"jsonrpc": "2.0",
"id": 3,
"method": "SearchListObjectFor",
"handle": 2,
"params": [
"/qListObjectDef",
"P"
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"qSuccess": true
},
"change": [
2
]
}
The search is successful.
3. Get the search results using the method GetLayout.
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": "ListObject01",
"qType": "ListObject"
},
"qMeta": {},
"qSelectionInfo": {},
"qListObject": {
"qStateName": "$",
"qSize": {
"qcx": 1,
"qcy": 1
},
"qDimensionInfo": {
"qFallbackTitle": "Country Label",
"qApprMaxGlyphCount": 14,
"qCardinal": 1,
"qSortIndicator": "A",
"qGroupFallbackTitles": [
"Country Label"
],
"qGroupPos": 0,
"qStateCounts": {
"qLocked": 0,
"qSelected": 0,
"qOption": 22,
"qDeselected": 0,
"qAlternative": 0,
"qExcluded": 0
},
"qTags": [
"$ascii",
"$text"
],
"qDimensionType": "D",
"qGrouping": "N"
},
"qExpressions": [],
"qDataPages": [
{
"qMatrix": [
[
{
"qText": "Portugal",
"qNum": "NaN",
"qElemNumber": 12,
"qState": "O",
"qHighlightRanges": {
"qRanges": [
{
"qCharPos": 0,
"qCharCount": 1
}
]
}
}
]
],
"qTails": [],
"qArea": {
"qLeft": 0,
"qTop": 0,
"qWidth": 1,
"qHeight": 1
}
}
]
}
}
}
}
The search has returned one value that starts with the letter P. It is the country Portugal.