# Get the number of distinct values of a field

Get the number of distinct values (cardinal) of a field by using the [GetCardinal method](https://help.qlik.com/en-US/sense-developer/November2024/Subsystems/EngineJSONAPI/Content/service-field-getcardinal.htm).

## Example

[](https://help.qlik.com/en-US/sense-developer/Subsystems/EngineAPI/Content/Sense_EngineAPI/WorkingWithAppsAndVisualizations/CreateVisualizations/get-number-distinct-values-field.htm)

#### The goal is to get the cardinal of a field.

The handle of the request is 2 because the handle of the field is 2.

The client sends:

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

The engine returns:

```
{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "qReturn": 22
  }
}
```

The number of distinct values of the field is 22.

## Learn more

* [Get the handle of a field](https://help.qlik.com/en-US/sense-developer/November2024/Subsystems/EngineAPI/Content/Sense_EngineAPI/WorkingWithAppsAndVisualizations/CreateVisualizations/get-handle-field.htm)