---
title: "Data Types"
framework: angular
version: "2.1.2"
---

# Data Types

Studio supports a variety of data types. Instead of being defined directly on fields, data types are defined on [Formats](https://www.ag-grid.com/studio/angular/formatting/). A Format controls formatting along with other behaviour.

```
const fields = [
    {
        id: 'athlete',
        format: 'textFormat' // textFormat uses the `string` data type
    },
    // ... other fields
];
```

When using [Sync Data](https://www.ag-grid.com/studio/angular/sync-data/) and not providing fields, the format is inferred from the data.

#### Data Types

```ts
import '@angular/compiler';
import { provideHttpClient } from '@angular/common/http';
import { bootstrapApplication } from '@angular/platform-browser';

import { AppComponent } from './app.component.ts';

const app = bootstrapApplication(AppComponent, {
    providers: [provideHttpClient()],
});
```

[Live example: Data Types](https://www.ag-grid.com/studio/examples/data-types/data-types/angular/)

## Data Types

Each of the data types are described in the table below. The input type is the JavaScript type that is supported in the source data. The default Format is the Format that will be used when inferring fields.

| Data Type | Input Type | Default Format |
| --- | --- | --- |
| `string` | `string` | `textFormat` |
| `number` | `number` | `integerFormat` / `decimalFormat` |
| `boolean` | `boolean` | `booleanFormat` |
| `date` | `Date \| string \| number` | `dateFormat` |
| `datetime` | `Date \| string \| number` | `dateTimeFormat` |

For `date` and `datetime`, the `string` value is expected to be in ISO-8601 format, and the `number` value is Unix epoch.

See [Formatting](https://www.ag-grid.com/studio/angular/formatting/) for how each data type is displayed and how to customise the display format.

## Null and Undefined Values

A field value can be missing - either `null` or `undefined`. AG Studio treats both the same way by default, across every data type.

### Display

A missing value is never passed to a Format's value formatter. Instead, the field shows that Format's `blankValue`:

| Data Type | Default Format | Blank display |
| --- | --- | --- |
| `string` | `textFormat` | `(Blanks)` |
| `number` | `integerFormat` / `decimalFormat` | `N/A` |
| `boolean` | `booleanFormat` | (empty) |
| `date` / `datetime` | `dateFormat` / `dateTimeFormat` | (empty) |

### Sorting

A missing value sorts as the smallest value by default, ahead of every other value in the field's data type, following the ascending-sort convention used by leading analytics and BI tools.

### Filtering

A missing value is excluded from filter results by default - for example, an `equals` or `between` condition never matches it.

### Aggregation

`sum`, `avg`, `min`, and `max` exclude missing values from the calculation. If every value in a group is missing, the result is `null` rather than `0` - this is standard practice across analytical engines, since a missing result and a true zero mean different things and collapsing them would hide information. `count` also excludes missing values.

`countd` (distinct count) counts a missing value as a distinct value by default, consistent with standard distinct-count semantics in analytical engines. `first` and `last` return the first or last non-missing value in sort order by default. Grouping treats a missing value as its own group rather than dropping those rows.
