Adaptable Scope

Scope specifies where an Adaptable Object in a Module can be applied.

It has 3 main values:

  • All - This will include every Column in a Row
  • Column(s) - An array of ColumnIds
  • DataType(s) - An array of Data Types (available values are: 'Boolean', 'Number', 'Date', 'String')

Modules Using Scope

The Scope object has been included in a number of Modules including:

This means that it is now possible to create a Conditional Style for all Numeric columns (e.g. Green Font for Positive values) with a single step.

Setting Scope

It is very straightforward to set Scope in Predefined Config:

Scope: All

To set a Scope of All you need to set 'All' to true as follows:

Scope: {
All: true,

This is typically done when using a Query rather than a Predicate and essentially will work on the whole row rather than individual columns.

Scope: ColumnIds

To set a Scope on one or more ColumnIds, simply provide an array of values:

Scope: {
ColumnIds: ['ItemCost', 'Package Cost', 'OrderCost'],

Scope: Data Types

To set a Scope of one or more Data Types, provide an array of values:

Scope: {
DataTypes: ['Number'],

Scope: Multiple Sections

It is possible - albeit rare - to include both DataType and ColumnIds in Scope.

For instance if you wanted a Conditional Style to paint all Date Columns plus 3 string 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 Scope.

createCellColorRangesForScope(scope)Creates Cell Color Ranges (used in Format Column) for given Scope
getColumnIdsInScope(scope)Returns all the ColumnIds in the Scope
getColumnsForScope(scope)Returns list of all Columns in the given 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
isColumnInStringsScope(column, scope)True if Scope has String 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
scopeHasDataType(scope)True if Scope contains DataTypes
scopeIsAll(scope)True if Scope is 'All'
scopeIsEmpty(scope)True if Scope is empty