Calculated Columns

Summary

  • Unlike regular columns, Calculated Columns do not display data from Infinite Table's underlying data source
  • Instead, the displayed values are derived (calculated) from other columns using an AdapTableQL Expression
  • The Expression always returns a single value and is evaluated and kept in sync with the live data
  • Once created a Calculated Column can be used and managed like any other Column in Infinite Table

Calculated Columns display values which are based on a supplied Expression.

This Expression is defined in the Column definition (using the expression property), and is evaluated by AdapTableQL.

The Expression typically references other columns and values in the Row and returns a single value.

Calculated Value

The Calculatd Value (i.e. the return value of the Expression) can be any basic DataType:

  • string
  • number
  • date
  • boolean

Note

  • When creating a Calculated Column in the UI, there is a dropdown where the Data Type can be selected
  • When the Calculated Colunn is provided at design-time, its supplied in the mandatory dataType property

Once created, Calculated Columns are treated as regular columns in AdapTable.

Basic Calculated Columns
Fork

This example provides 3 Calculated Columns:

  • 2 x Stars - multiplies Stars column by 2 using Expression: [github_stars] * 2
  • Popularity - uses ternary logic on Stars column to assess popularity using Expression: [github_stars] > 80000 ? "High" : [github_stars] > 15000 ? "Medium" : "Low"
  • All PRs - sums the Open PRs and Closed PRs columns using Expression: [open_pr_count] + [closed_pr_count]

Styling Calculated Columns

Calculated Columns are normal Columns which mean they can be formatted and styled like any other Column.

Styling Calculated Columns
Fork

This example demonstrates styling and formatting Calculated Columns (using the same Calculated Columns as in the example above):

  • All PRs Calculated Column is bold
  • The whole row is yellow where 2 x Stars is over 40,000
  • Popularity is styled, italicised and capitalised where its value is "High"

Referenced Calculated Columns

Calculated Columns are able themselves to reference other Calculated Columns if required.

Basic Calculated Columns
Fork

This (slightly contrived) example demonstrates Referenced Calculated Columns:

  • 2 x Stars - multiplies Stars column by 2 using Expression: [github_stars] * 2
  • 20 x Stars - multiplies the 2 x Stars Calculated Column by 10 using Expression: [2xstars] * 10
  • 100 x Stars - multiplies the 20 x Stars Calculated Column by 5 using Expression: [20xstars] * 5