Column Scope
Summary
- Column Scope defines in which columns a given AdapTable feature is applied
- It can be comprise named Columns, Data Types, Column Types or a whole Row
Column Scope specifies where an AdapTable Feature can be applied.
It sets which columns any given Adaptable Object will be evaluated for.
The Column Scope object has 4 main types of values:
Note
Typically, Scope will include only of these 4 types
- All - This will include every Column in a Row
- Column(s) - An array of ColumnIds
- Data Type(s) - An array of Data Types (available values are:
text,number,booleananddate) - Column Type(s) - An array of strings which specify which Column Types to use
Where Column Scope is Used
Column Scope is used widely in AdapTable in both Initial Adaptable State sections and Adaptable Options.
Some of the usage for Column Scope includes:
- Alerts
- Column Formatting
- Custom Sort Comparers
- Export (used in Custom Reports)
- Flashing Cells
- Plus Minus
- Shortcuts
This allows you greater flexibility when creating objects. For instance you can set:
- one Format Column for all Numeric columns (e.g. Green Font for Positive values)
- a Data Validation Alert for a given set of named columns
- a Display Format for all Columns of a bespoke Column Type (e.g. 'pricing')
- a subset of columns to be exported in a Report
Using Column Scope
The Adaptable UI makes it easy to set the Column Scope of an object that is being created or edited.
UI Step by Step Guide
Setting Column Scope in a Settings Panel Wizard
Configuring Column Scope
It is very straightforward to set Column Scope in Initial Adaptable State:
Scope: All
To set a Scope of All (i.e. the whole row) you need to set 'All' to true:
Scope: { All: true }Hint
- This is typically done when the object uses an Expression rather than a Predicate
- Esentially it will operate over the whole row rather than individual columns
Scope: ColumnIds
To set a Scope on one or more Columns, simply provide an array of ColumnIdsvalues:
Scope: { ColumnIds: ['ItemCost', 'Package Cost', 'OrderCost'] }Scope: Data Types
To set a Scope of one or more Data Types (e.g. number, text), provide an array of DataTypes values:
Scope: { DataTypes: ['number'] }Scope: Column Types
To set a Scope of one or more Column Types, provide an array of strings that contain available ColumnTypes:
Scope: { ColumnTypes: ['number-column', 'price', 'calculatedColumn'] }Scope: Multiple Sections
It is possible - albeit rare - to provide multiple Scope types (e.g. DataType and ColumnIds).
For instance to use Column Formatting to format all date Columns plus 3 other Columns you could do:
Scope: {
DataTypes: ['date'],
ColumnIds: ['country', 'currency', 'counterparty']
},Scope API
The Scope API section of Adaptable API contains a number of methods for managing Column Scope:
| Method | Description |
|---|---|
| areAllBooleanColumnsInScope(scope) | True if all selected columns are boolean |
| createCellColorRangesForScope(scope) | Creates Cell Color Ranges (used in Format Column) for given Scope |
| getColumnIdsInScope(scope) | Returns all the ColumnIds in the Scope |
| getColumnsInScope(scope) | Returns list of all Columns in the given Scope |
| getColumnTypesInScope(scope) | Returns all the ColumnTypes in the Scope |
| getDataTypesInScope(scope) | Returns all the DataTypes in the Scope |
| getScopeDescription(scope) | Provides a description for the Scope |
| getScopeToString(scope) | Gets string representation of the Scope |
| getSingleColumnInScope(scope) | Gets the only Column in given Scope |
| isColumnInDateScope(column, scope) | True if Scope has Data DataType which contains Column |
| isColumnInNumericScope(column, scope) | True if Scope has Numeric DataType containing Column |
| isColumnInScope(column, scope) | True if Column is in given Scope |
| isColumnInScopeColumns(column, scope) | True if Column is in Scope's 'ColumnIds' section |
| isColumnInTextScope(column, scope) | True if Scope has text DataType containing Column |
| isPrimaryKeyColumnInScopeColumns(scope) | Whether PK column is included in Scope's column section |
| isScopeInScope(scopeA, scopeB) | True if first scope is in second Scope |
| isSingleBooleanColumnScope(scope) | True if Scope contains just 1 boolean Column |
| isSingleColumnScope(scope) | True if Scope contains just 1 ColumnId |
| isSingleNumericColumnScope(scope) | True if Scope contains just 1 numeric Column |
| scopeHasColumns(scope) | True if Scope contains ColumnIds |
| scopeHasColumnType(scope) | True if Scope contains ColumnTypes |
| scopeHasDataType(scope) | True if Scope contains DataTypes |
| scopeHasOnlyBooleanDataType(scope) | True if Scope is DataTypes and contains just 'Boolean' |
| scopeIsAll(scope) | True if Scope is 'All' |
| scopeIsEmpty(scope) | True if Scope is empty |