# Clear the selections of a specific field

Clear the selections of a specific field by using the [Clear method](https://help.qlik.com/en-US/sense-developer/May2025/Subsystems/EngineJSONAPI/Content/service-field-clear.htm).

## Example

[](https://help.qlik.com/en-US/sense-developer/Subsystems/EngineAPI/Content/Sense_EngineAPI/DiscoveringAndAnalysing/MakeSelections/clear-selections-specific-field.htm)

#### The goal is to make selections and create a bookmark. Then the selections are cleared and the bookmark is applied.

The handle of the app is 1.

1. Create a sheet SH01 (qId is SH01) in the app.

The client sends:

```
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "CreateObject",
  "handle": 1,
  "params": [
    {
      "title": "Sheet1",
      "description": "Description of sheet 1",
      "qInfo": {
        "qId": "SH01",
        "qType": "sheet"
      },
      "qChildListDef": {
        "qData": {
          "title": "/title",
          "description": "/description",
          "meta": "/meta",
          "order": "/order",
          "type": "/qInfo/qType",
          "id": "/qInfo/qId",
          "lb": "/qListObjectDef",
          "hc": "/qHyperCubeDef"
        }
      }
    }
  ]
}
```

The engine returns:

```
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "qReturn": {
      "qType": "GenericObject",
      "qHandle": 2
    },
    "qInfo": {
      "qId": "SH01",
      "qType": "sheet"
    }
  },
  "change": [
    2
  ]
}
```

The sheet is created and its handle is 2.

2. Create a list object LB01 (qId is LB01) in the sheet. The list object has Country (qFieldDefs is Country) as a dimension.

The client sends:

```
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "CreateChild",
  "handle": 2,
  "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 ListObject01"
    }
  ]
}
```

The engine returns:

```
{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "qReturn": {
      "qType": "GenericObject",
      "qHandle": 3
    },
    "qInfo": {
      "qId": "LB01",
      "qType": "ListObject"
    }
  },
  "change": [
    3
  ]
}
```

The list object is created and its handle is 3.

3. Select the first element number (qValues is 0) in the list object (qPath is /qListObjectDef).

The client sends:

```
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "SelectListObjectValues",
  "handle": 3,
  "params": [
    "/qListObjectDef",
    [
      0
    ],
    false
  ]
}
```

The engine returns:

{ "jsonrpc": "2.0", "id": 3, "result": { "qSuccess": true }, "change": [ 3 ] }

The selection is successful.

4. Retrieve the first three values of the list object (qTop is 0 and qHeight is 3).

The client sends:

{ "jsonrpc": "2.0", "id": 4, "method": "GetListObjectData", "handle": 3, "params": [ "/qListObjectDef", [ { "qTop": 0, "qHeight": 3, "qLeft": 0, "qWidth": 1 } ] ] }

The engine returns:

{ "jsonrpc": "2.0", "id": 4, "result": { "qDataPages": [ { "qMatrix": [ [ { "qText": "United States", "qNum": "NaN", "qElemNumber": 0, "qState": "S" } ], [ { "qText": "Denmark", "qNum": "NaN", "qElemNumber": 1, "qState": "X" } ], [ { "qText": "Spain", "qNum": "NaN", "qElemNumber": 2, "qState": "X" } ] ], "qTails": [], "qArea": { "qLeft": 0, "qTop": 0, "qWidth": 1, "qHeight": 3 } } ] } }

The value United States is selected.

5. Create a bookmark BM01 (qId is BM01). The handle of the request is 1 because the [CreateBookmark method](https://help.qlik.com/en-US/sense-developer/May2025/Subsystems/EngineJSONAPI/Content/service-doc-createbookmark.htm) applies at the app level.

The client sends:

{ "jsonrpc": "2.0", "id": 5, "method": "CreateBookmark", "handle": 1, "params": [ { "qInfo": { "qId": "BM01", "qType": "Bookmark" } } ] }

The engine returns:

{ "jsonrpc": "2.0", "id": 5, "result": { "qReturn": { "qType": "GenericBookmark", "qHandle": 4 }, "qInfo": { "qId": "BM01", "qType": "Bookmark" } }, "change": [ 4 ] }

The bookmark is created and the handle is 4.

6. Get the handle of the field Country. The handle of the request is 1 because the [GetField method](https://help.qlik.com/en-US/sense-developer/May2025/Subsystems/EngineJSONAPI/Content/service-doc-getfield.htm) applies at the app level.

The client sends:

{ "jsonrpc": "2.0", "id": 6, "method": "GetField", "handle": 1, "params": [ "Country" ] }

The engine returns:

{ "jsonrpc": "2.0", "id": 6, "result": { "qReturn": { "qType": "Field", "qHandle": 5 } } }

The handle of the field Country is 5.

7. Clear the field. The handle of the request is 5 because the field to clear has 5 as a handle.

The client sends:

{ "jsonrpc": "2.0", "id": 7, "method": "Clear", "handle": 5, "params": [] }

The engine returns:

{ "jsonrpc": "2.0", "id": 7, "result": { "qReturn": true }, "change": [ 1, 3, 5 ] }

The field Country is cleared of selections.

8. Retrieve the first three values (qTop is 0 and qHeight is 3) of the list object. The handle of the request is 3 because the list object has 3 as a handle.

The client sends:

{ "jsonrpc": "2.0", "id": 8, "method": "GetListObjectData", "handle": 3, "params": [ "/qListObjectDef", [ { "qTop": 0, "qHeight": 3, "qLeft": 0, "qWidth": 1 } ] ] }

The engine returns:

{ "jsonrpc": "2.0", "id": 8, "result": { "qDataPages": [ { "qMatrix": [ [ { "qText": "United States", "qNum": "NaN", "qElemNumber": 0, "qState": "O" } ], [ { "qText": "Denmark", "qNum": "NaN", "qElemNumber": 1, "qState": "O" } ], [ { "qText": "Spain", "qNum": "NaN", "qElemNumber": 2, "qState": "O" } ] ], "qTails": [], "qArea": { "qLeft": 0, "qTop": 0, "qWidth": 1, "qHeight": 3 } } ] } }

All values are in the optional state.

9. Apply the bookmark BM01.

The client sends:

{ "jsonrpc": "2.0", "id": 9, "method": "ApplyBookmark", "handle": 1, "params": [ "BM01" ] }

The engine returns:

{ "jsonrpc": "2.0", "id": 9, "result": { "qSuccess": true }, "change": [ 1, 3, 5 ] }

The bookmark is successfully applied.

10. Retrieve the first three values (qTop is 0 and qHeight is 3) of the list object. The handle of the request is 3 because the list object has 3 as a handle.

The client sends:

{ "jsonrpc": "2.0", "id": 10, "method": "GetListObjectData", "handle": 3, "params": [ "/qListObjectDef", [ { "qTop": 0, "qHeight": 3, "qLeft": 0, "qWidth": 1 } ] ] }

The engine returns:

{ "jsonrpc": "2.0", "id": 10, "result": { "qDataPages": [ { "qMatrix": [ [ { "qText": "United States", "qNum": "NaN", "qElemNumber": 0, "qState": "S" } ], [ { "qText": "Denmark", "qNum": "NaN", "qElemNumber": 1, "qState": "X" } ], [ { "qText": "Spain", "qNum": "NaN", "qElemNumber": 2, "qState": "X" } ] ], "qTails": [], "qArea": { "qLeft": 0, "qTop": 0, "qWidth": 1, "qHeight": 3 } } ] } }

The value United States is selected (same result as in step 4).