# ColumnScopeApi

Canonical page: https://www.adaptabletools.com/docs/reference/columnscopeapi

Whether a column is inside a Column Scope, and the columns, types and data types a scope contains.

```ts title="TypeScript"
export interface ColumnScopeApi 
```

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [areAllBooleanColumnsInScope(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#areallbooleancolumnsinscope) | `boolean` | True if all selected columns are boolean |
| [createCellColorRangesForScope(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#createcellcolorrangesforscope) | [`CellColorRange`](https://www.adaptabletools.com/docs/reference/cellcolorrange.md)`[]` | Creates a default single `CellColorRange` for Styled Column wizards (Gradient,<br/>Percent Bar, Bullet Chart): `Col-Min` → `Col-Max` with neutral gray, matching<br/>the colour used when adding a range in the Ranges UI. If the column has no<br/>sample values yet, returns one `0` → `0` gray range. |
| [getAnyColumnIdForScope(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#getanycolumnidforscope) | `string \| undefined` | Gets any ColumnId from the Scope |
| [getColumnIdsInScope(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#getcolumnidsinscope) | `string[] \| undefined` | Returns all the ColumnIds in the Scope |
| [getColumnsInScope(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#getcolumnsinscope) | [`AdaptableColumn`](https://www.adaptabletools.com/docs/reference/adaptablecolumn.md)`[]` | Returns list of all Columns in the given Scope |
| [getColumnTypesInScope(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#getcolumntypesinscope) | `string[] \| undefined` | Returns all the ColumnTypes in the Scope |
| [getDataTypesInScope(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#getdatatypesinscope) | `ScopeDataType[] \| undefined` | Returns all the DataTypes in the Scope |
| [getScopeDescription(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#getscopedescription) | `string` | Provides a description for the Scope |
| [getScopeToString(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#getscopetostring) | `string` | Gets string representation of the Scope |
| [getSingleColumnInScope(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#getsinglecolumninscope) | `string \| undefined` | Gets the only Column in given Scope |
| [isColumnInDateScope(column, scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#iscolumnindatescope) | `boolean` | True if Scope has Data DataType which contains Column |
| [isColumnInNumericScope(column, scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#iscolumninnumericscope) | `boolean` | True if Scope has Numeric DataType containing Column |
| [isColumnInScope(column, scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#iscolumninscope) | `boolean` | True if Column is in given Scope |
| [isColumnInScopeColumns(column, scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#iscolumninscopecolumns) | `boolean` | True if Column is in Scope&#39;s &#39;ColumnIds&#39; section |
| [isColumnInTextScope(column, scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#iscolumnintextscope) | `boolean` | True if Scope has text DataType containing Column |
| [isPrimaryKeyColumnInScopeColumns(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#isprimarykeycolumninscopecolumns) | `boolean` | Whether PK column is included in Scope&#39;s column section |
| [isScopeInScope(scopeA, scopeB)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#isscopeinscope) | `boolean` | True if first scope is in second Scope<br/><br/>Scope A \| Scope B \| Result<br/> ===========================================================================<br/> All * true<br/> * All true<br/> DataTypes DataTypes all DataTypes from A should be in B<br/> ColumnIds ColumnIds all ColumnIds from A should be in B<br/> ColumnIds DataTypes all DataTypes of ColumnIds from A should be in B<br/> DataTypes ColumnIds false |
| [isSingleBooleanColumnScope(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#issinglebooleancolumnscope) | `boolean` | True if Scope contains just 1 boolean Column |
| [isSingleColumnScope(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#issinglecolumnscope) | `boolean` | True if Scope contains just 1 ColumnId |
| [isSingleNumericColumnScope(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#issinglenumericcolumnscope) | `boolean` | True if Scope contains just 1 numeric Column |
| [scopeHasColumns(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#scopehascolumns) | `boolean` | True if Scope contains ColumnIds |
| [scopeHasColumnType(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#scopehascolumntype) | `boolean` | True if Scope contains ColumnTypes |
| [scopeHasDataType(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#scopehasdatatype) | `boolean` | True if Scope contains DataTypes |
| [scopeHasOnlyBooleanDataType(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#scopehasonlybooleandatatype) | `boolean` | True if Scope is DataTypes and contains just &#39;Boolean&#39; |
| [scopeIsAll(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#scopeisall) | `boolean` | True if Scope is &#39;All&#39; |
| [scopeIsEmpty(scope)](https://www.adaptabletools.com/docs/reference/columnscopeapi.md#scopeisempty) | `boolean` | True if Scope is empty |

## Method Details

### areAllBooleanColumnsInScope

True if all selected columns are boolean

```ts title="TypeScript"
areAllBooleanColumnsInScope(scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 True if all selected columns are boolean

`boolean`

### createCellColorRangesForScope

Creates a default single `CellColorRange` for Styled Column wizards (Gradient,
Percent Bar, Bullet Chart): `Col-Min` → `Col-Max` with neutral gray, matching
the colour used when adding a range in the Ranges UI. If the column has no
sample values yet, returns one `0` → `0` gray range.

```ts title="TypeScript"
createCellColorRangesForScope(scope: ColumnScope): CellColorRange[];
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to use (must resolve to a single column for range sampling) |

###### Returns

 A single `CellColorRange` for Styled Column wizards (Gradient, Percent Bar, Bullet Chart): `Col-Min` → `Col-Max` with neutral gray, matching the colour used when adding a range in the Ranges UI. If the column has no sample values yet, returns one `0` → `0` gray range

[`CellColorRange`](https://www.adaptabletools.com/docs/reference/cellcolorrange.md)`[]`

### getAnyColumnIdForScope

Gets any ColumnId from the Scope

```ts title="TypeScript"
getAnyColumnIdForScope(scope: ColumnScope): string | undefined;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 Any ColumnId from the Scope

`string | undefined`

### getColumnIdsInScope

Returns all the ColumnIds in the Scope

```ts title="TypeScript"
getColumnIdsInScope(scope: ColumnScope): string[] | undefined;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 All the ColumnIds in the Scope

`string[] | undefined`

### getColumnsInScope

Returns list of all Columns in the given Scope

```ts title="TypeScript"
getColumnsInScope(scope: ColumnScope): AdaptableColumn[];
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | the Scope to check |

###### Returns

 List of all Columns in the given Scope

[`AdaptableColumn`](https://www.adaptabletools.com/docs/reference/adaptablecolumn.md)`[]`

### getColumnTypesInScope

Returns all the ColumnTypes in the Scope

```ts title="TypeScript"
getColumnTypesInScope(scope: ColumnScope): string[] | undefined;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 All the ColumnTypes in the Scope

`string[] | undefined`

### getDataTypesInScope

Returns all the DataTypes in the Scope

```ts title="TypeScript"
getDataTypesInScope(scope: ColumnScope): ScopeDataType[] | undefined;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 All the DataTypes in the Scope

`ScopeDataType[] | undefined`

### getScopeDescription

Provides a description for the Scope

```ts title="TypeScript"
getScopeDescription(scope: ColumnScope): string;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | The Scope to check |

###### Returns

 A description of the scope

`string`

### getScopeToString

Gets string representation of the Scope

```ts title="TypeScript"
getScopeToString(scope: ColumnScope): string;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 String representation of the Scope

`string`

### getSingleColumnInScope

Gets the only Column in given Scope

```ts title="TypeScript"
getSingleColumnInScope(scope: ColumnScope): string | undefined;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 The only Column in given Scope

`string | undefined`

### isColumnInDateScope

True if Scope has Data DataType which contains Column

```ts title="TypeScript"
isColumnInDateScope(column: AdaptableColumn, scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| column | [`AdaptableColumn`](https://www.adaptabletools.com/docs/reference/adaptablecolumn.md) | Column to check |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 True if Scope has Data DataType which contains Column

`boolean`

### isColumnInNumericScope

True if Scope has Numeric DataType containing Column

```ts title="TypeScript"
isColumnInNumericScope(column: AdaptableColumn, scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| column | [`AdaptableColumn`](https://www.adaptabletools.com/docs/reference/adaptablecolumn.md) | Column to check |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 True if Scope has Numeric DataType containing Column

`boolean`

### isColumnInScope

True if Column is in given Scope

```ts title="TypeScript"
isColumnInScope(column: AdaptableColumn | undefined, scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| column | [`AdaptableColumn`](https://www.adaptabletools.com/docs/reference/adaptablecolumn.md)` \| undefined` | Column to check |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | The Scope to check |

###### Returns

 True if Column is in given Scope

`boolean`

### isColumnInScopeColumns

True if Column is in Scope&#39;s &#39;ColumnIds&#39; section

```ts title="TypeScript"
isColumnInScopeColumns(column: AdaptableColumn, scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| column | [`AdaptableColumn`](https://www.adaptabletools.com/docs/reference/adaptablecolumn.md) | Column to check |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 True if Column is in Scope&#39;s &#39;ColumnIds&#39; section

`boolean`

### isColumnInTextScope

True if Scope has text DataType containing Column

```ts title="TypeScript"
isColumnInTextScope(column: AdaptableColumn, scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| column | [`AdaptableColumn`](https://www.adaptabletools.com/docs/reference/adaptablecolumn.md) | Column to check |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 True if Scope has text DataType containing Column

`boolean`

### isPrimaryKeyColumnInScopeColumns

Whether PK column is included in Scope&#39;s column section

```ts title="TypeScript"
isPrimaryKeyColumnInScopeColumns(scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 `true` when PK column is included in Scope&#39;s column section

`boolean`

### isScopeInScope

True if first scope is in second Scope

Scope A | Scope B | Result
 ===========================================================================
 All * true
 * All true
 DataTypes DataTypes all DataTypes from A should be in B
 ColumnIds ColumnIds all ColumnIds from A should be in B
 ColumnIds DataTypes all DataTypes of ColumnIds from A should be in B
 DataTypes ColumnIds false

```ts title="TypeScript"
isScopeInScope(scopeA: ColumnScope, scopeB: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scopeA | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | first Scope |
| scopeB | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | second Scope |

###### Returns

 True if first scope is in second Scope Scope A | Scope B | Result =========================================================================== All * true * All true DataTypes DataTypes all DataTypes from A should be in B ColumnIds ColumnIds all ColumnIds from A should be in B ColumnIds DataTypes all DataTypes of ColumnIds from A should be in B DataTypes ColumnIds false

`boolean`

### isSingleBooleanColumnScope

True if Scope contains just 1 boolean Column

```ts title="TypeScript"
isSingleBooleanColumnScope(scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 True if Scope contains just 1 boolean Column

`boolean`

### isSingleColumnScope

True if Scope contains just 1 ColumnId

```ts title="TypeScript"
isSingleColumnScope(scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 True if Scope contains just 1 ColumnId

`boolean`

### isSingleNumericColumnScope

True if Scope contains just 1 numeric Column

```ts title="TypeScript"
isSingleNumericColumnScope(scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 True if Scope contains just 1 numeric Column

`boolean`

### scopeHasColumns

True if Scope contains ColumnIds

```ts title="TypeScript"
scopeHasColumns(scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 True if Scope contains ColumnIds

`boolean`

### scopeHasColumnType

True if Scope contains ColumnTypes

```ts title="TypeScript"
scopeHasColumnType(scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 True if Scope contains ColumnTypes

`boolean`

### scopeHasDataType

True if Scope contains DataTypes

```ts title="TypeScript"
scopeHasDataType(scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 True if Scope contains DataTypes

`boolean`

### scopeHasOnlyBooleanDataType

True if Scope is DataTypes and contains just &#39;Boolean&#39;

```ts title="TypeScript"
scopeHasOnlyBooleanDataType(scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 True if Scope is DataTypes and contains just &#39;Boolean&#39;

`boolean`

### scopeIsAll

True if Scope is &#39;All&#39;

```ts title="TypeScript"
scopeIsAll(scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 True if Scope is &#39;All&#39;

`boolean`

### scopeIsEmpty

True if Scope is empty

```ts title="TypeScript"
scopeIsEmpty(scope: ColumnScope): boolean;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| scope | [`ColumnScope`](https://www.adaptabletools.com/docs/reference/columnscope.md) | Scope to check |

###### Returns

 True if Scope is empty

`boolean`
