Column Scope

View as Markdown

Summary

  • Column Scope defines in which columns a given AdapTable feature is applied
  • It can 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 one 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, boolean, date, textArray and numberArray)
  • 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:

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

When the object also has an Expression (a Format Column Rule, Flashing Cell Rule, Alert, and so on), use the $SCOPE function to refer to the current column in that Scope.

That lets you write one Expression - e.g. IS_POSITIVE($SCOPE) - that applies to every column the Scope covers, instead of naming each ColumnId.

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
  • Essentially 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 ColumnIds values:

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']
},

Find Out More

The Column Scope API is in the Column Scope Technical Reference