# Select some values in a list object

Select some values in a list object by using the [SelectListObjectValues method](https://help.qlik.com/en-US/sense-developer/November2024/Subsystems/EngineJSONAPI/Content/service-genericobject-selectlistobjectvalues.htm).

## Example

[](https://help.qlik.com/en-US/sense-developer/Subsystems/EngineAPI/Content/Sense_EngineAPI/DiscoveringAndAnalysing/MakeSelections/select-some-values-in-list-object.htm)

#### The first step of this example is to display a list object where all values are selected. The goal is to select only the first value.

1. Get the layout of the list object (handle is 2).

The client sends:

```
{
    "jsonrpc": "2.0",
    "id": 3,
    "method": "GetLayout",
    "handle": 2,
    "params": [
        
    ]
}
```

The engine returns:

```
{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "qLayout": {
      "qInfo": {
        "qId": "LI01",
        "qType": "ListObject"
      },
      "qMeta": {},
      "qSelectionInfo": {},
      "qListObject": {
        "qStateName": "$",
        "qSize": {
          "qcx": 1,
          "qcy": 22
        },
        "qDimensionInfo": {
          "qFallbackTitle": "Country Label",
          "qApprMaxGlyphCount": 14,
          "qCardinal": 22,
          "qSortIndicator": "A",
          "qGroupFallbackTitles": [
            "Country Label"
          ],
          "qGroupPos": 0,
          "qStateCounts": {
            "qLocked": 0,
            "qSelected": 22,
            "qOption": 0,
            "qDeselected": 0,
            "qAlternative": 0,
            "qExcluded": 0
          },
          "qTags": [
            "$ascii",
            "$text"
          ],
          "qDimensionType": "D",
          "qGrouping": "N"
        },
        "qExpressions": [],
        "qDataPages": [
          {
            "qMatrix": [
              [
                {
                  "qText": "United States",
                  "qNum": "NaN",
                  "qElemNumber": 0,
                  "qState": "S"
                }
              ],
              [
                {
                  "qText": "Denmark",
                  "qNum": "NaN",
                  "qElemNumber": 1,
                  "qState": "S"
                }
              ],
              [
                {
                  "qText": "Spain",
                  "qNum": "NaN",
                  "qElemNumber": 2,
                  "qState": "S"
                }
              ],
              [
                {
                  "qText": "Canada",
                  "qNum": "NaN",
                  "qElemNumber": 3,
                  "qState": "S"
                }
              ],
              [
                {
                  "qText": "Netherlands",
                  "qNum": "NaN",
                  "qElemNumber": 4,
                  "qState": "S"
                }
              ]
            ],
            "qTails": [],
            "qArea": {
              "qLeft": 0,
              "qTop": 0,
              "qWidth": 1,
              "qHeight": 5
            }
          }
        ]
      }
    }
  }
}
```

All values are selected.

2. Select the first value of the list object.

The client sends:

```
{
    "jsonrpc": "2.0",
    "id": 4,
    "method": "SelectListObjectValues",
    "handle": 2,
    "params": [
        "/qListObjectDef",
        [
            1
        ],
        false
    ]
}
```

The engine returns:

```
{
  "jsonrpc": "2.0",
  "id": 4,
  "result": {
    "qSuccess": true
  },
  "change": [
    2
  ]
}
```

The value Denmark ( "qElemNumber": 1) is selected.

3. Get the layout of the list object.

The client sends:

```
{
  "jsonrpc": "2.0",
  "id": 5,
  "method": "GetLayout",
  "handle": 2,
  "params": []
}
```

The engine returns:

{ "jsonrpc": "2.0", "id": 5, "result": { "qLayout": { "qInfo": { "qId": "LI01", "qType": "ListObject" }, "qMeta": {}, "qSelectionInfo": {}, "qListObject": { "qStateName": "$", "qSize": { "qcx": 1, "qcy": 22 }, "qDimensionInfo": { "qFallbackTitle": "Country Label", "qApprMaxGlyphCount": 14, "qCardinal": 22, "qSortIndicator": "A", "qGroupFallbackTitles": [ "Country Label" ], "qGroupPos": 0, "qStateCounts": { "qLocked": 0, "qSelected": 1, "qOption": 0, "qDeselected": 0, "qAlternative": 21, "qExcluded": 0 }, "qTags": [ "$ascii", "$text" ], "qDimensionType": "D", "qGrouping": "N" }, "qExpressions": [], "qDataPages": [ { "qMatrix": [ [ { "qText": "United States", "qNum": "NaN", "qElemNumber": 0, "qState": "X" } ], [ { "qText": "Denmark", "qNum": "NaN", "qElemNumber": 1, "qState": "S" } ], [ { "qText": "Spain", "qNum": "NaN", "qElemNumber": 2, "qState": "X" } ], [ { "qText": "Canada", "qNum": "NaN", "qElemNumber": 3, "qState": "X" } ], [ { "qText": "Netherlands", "qNum": "NaN", "qElemNumber": 4, "qState": "X" } ] ], "qTails": [], "qArea": { "qLeft": 0, "qTop": 0, "qWidth": 1, "qHeight": 5 } } ] } } } }

Only the first value is selected (state is S). The other values are excluded.

## Learn more

* [ListObject](https://help.qlik.com/en-US/sense-developer/November2024/Subsystems/EngineJSONAPI/Content/models-listobject.htm)