Support/collections

Computed Fields


Computed Fields automatically create their own value based on the information stored in other Fields within a Record. They are especially useful for performing calculations within a Collection and work similarly to Excel spreadsheet commands.

How to Create a Computed Field

Accessing Computed Fields

Computed fields are accessed in the same way as regular fields. You can see how to Configure fields here.

  1. Choose a collection to configure from your Sidebar.
  2. Open the options menu (⋯) in your Toolbar, at the top right of your screen. Select “Configure” from the available options.

  1. In the fields pane of your collection configuration page, you will see a list of all fields within the current collection.
  2. Click "Add Field".
  3. Open the dropdown list of options beneath “TYPE”. You can either search for “Computed” or scroll through the first column to find it.
How to Find Computed Field
  1. Once you have selected “Computed”, Kinabase will provide the following Computed Field options:

Computed (Text):
Text that can include other fields in the record using a template.

Computed (Number):
A number that is calculated from other fields in the record using a formula.

Computed (Date):
A date that is calculated from other fields in the record using a formula.

Lookup:
A field that copies its value from another record in a linked collection.

Aggregation:
A number that is calculated from records in a linked collection.

  1. You can choose the appropriate field type based on your needs.

How to get your computed field to access the other fields in your collection

To create a new value in your computed field, you need to specify which other fields it should access. These instructions go into the “TEMPLATE” section.

Field values are accessed by using the “$” symbol, followed by the field name in ALL CAPS. Spaces in field names are replaced by underscores.

Example: For a field called "First Name", you would type $FIRST_NAME into your template:

Computed Field Example Showing 'Full Name'

Subfields

Some field types have extra values stored in "subfields". You can access and display these values by typing the $FIELD_NAME, followed by the SUBFIELD_NAME, seperated by a full stop ($FIELD_NAME.SUBFIELD_NAME).

This is useful when you want to extract specific information from a field, such as the postcode from an address field.

Here are some of the subfields we have on Kinabase:

  • Location field - TITLE, LINE_1, LINE_2, CITY, COUNTY, COUNTRY, POSTCODE, LAT, LNG
  • Date range - START, END, DURATION, ACTUAL_START, ACTUAL_END
  • Risk score - IMPACT, LIKELIHOOD

Example:

Subfield Example with $ADDRESS.POSTCODE

The instructions above would create the following record:

Subfield Example with $ADDRESS.POSTCODE

Mathematical functions

You can use basic maths operator (+ - * / and brackets) when creating a computed field. Be sure to include a space on either side of an operator.

Computed Field using Operators

Numbers with units

You can add units to constant numbers and use them in calculations. Units can be combined with * and / (this time without spaces). Kinabase understands a wide range of units, including SI units, time, and currency, and will automatically convert between them.

Example: For a mileage field (stored in miles), a formula of $MILEAGE * £3.50/mi would give you your new value in pounds (£).

Here are some more examples of what this might look like:

  • 45m3 - 45 cubic metres
  • 70mi/h - 70 miles per hour
  • 30deg - 30 degrees (angle)

Full list of units

Below is a full list of units supported in Kinabase.

SI Base Units

UnitDescriptionSymbol
MetreLengthm
KilogramMasskg
SecondTimes
AmpereElectrical CurrentA
KelvinTemperature measured from absolute zeroK
MoleAmount of substancemol
CandelaLuminositycad
ByteAmount of data (note: 1kB = 1000B)B

All of the units above can be used, except for Kilograms and Seconds in some specific cases.

Additional time units

UnitDescriptionSymbol
Minute60 secondsmin
Hour60 minutes, 3600 secondsh
Day24 hoursd

Additional mass units

UnitDescriptionSymbol
Gram0.001 kgg
Tonne1000 kgt

Dimensionless units

UnitDescriptionSymbol
RadiansAngle (2π in a full revolution)rad
DegreesAngle (360 in a full revolution)deg
PercentageProportion, 1 / 100%
Parts per millionProportion, 1 / 1,000,000ppm

Temperature

UnitDescriptionSymbol
CelciusTemperature measured from freezing point of waterdegC

Common UK Units

UnitDescriptionSymbol
MilesDistance, = 1609.344 mmi
PintsVolume, = 568.26 mlpt
Pounds SterlingUK Currency£

Area

UnitDescriptionSymbol
Hectare10,000 square metres (100m × 100m)ha
Square Kilometres1,000,000 square metres (1km × 1km)km2
Square Centimetres1cm × 1cmcm2

Volume

UnitDescriptionSymbol
LitreVolume of 10cm cube, 0.001 cubic metresl
Millilitre0.001 litresml

If function

Conditional logic is possible through the IF function, which follows this syntax:

IF([condition], [result if true], [result if false])

Example: IF($COST > £4, $COST * 2, $COST * 2.5) would either:

  • Multiply the cost by 2 if the cost exceeds £4.00, or
  • Multiply it by 2.5 if the cost is less than or equal to £4.00.

This could also be simplified as $COST * IF($COST > £4, 1.5, 2.5).

Conditions

Numerical

  • = - Equals
  • != - Does not equal
  • >, < - Greater than, less than
  • >=, <= - Greater than or equal to, less than or equal to

Text

  • is blank - Field is empty (e.g. $NAME is blank)
  • matches - Equality (e.g. $NAME matches "John")
  • contains, starts with, ends with

Date + Time

  • is in - Matches, considering precision (e.g. $START_DATE is in 2024)
  • is before, is after

Combining

  • not ... - Inverts result (e.g. not $LENGTH > 1m is equivalent to $LENGTH <= 1m)
  • ... and ... - True if both sides are true (can be chained)

(e.g. $LENGTH > 1m and $WIDTH > 1m and $HEIGHT > 1m)

  • ... or ... - True if either side is true (can also be chained)

(e.g $LENGTH > 1m or $WIDTH > 1m or $HEIGHT > 1m is True if any dimension exceeds 1 metre)

  • ... xor ... - Exclusive, or True if either side is true but not both

Handling Empty Values

If a field is left empty (null), operations involving that field will return empty (null). To fall back to a default value, use the coalescing operator ??.

Syntax: [value to check] ?? [fallback value]

Example: $PROFIT ?? ($INCOME * 10%) will return the “Profit” if available, or calculate 10% of the “Income” if not.

Computed Text Fields

Computed Text Fields use the same method to access field values, but they insert values into a template instead of calculating them.

Example: This apple is a $TYPE and tastes $REVIEW could display as: "This apple is a Granny Smith and tastes Amazing".

There are a few special cases for this formatting:

  • Adding a second $ ends the accessor early.

Example: This fruit is a $TYPE$FRUIT could display as: "This fruit is a GRAPEFRUIT"

  • To insert an actual dollar symbol, use $$.

Example: This $TYPE apple costs $$3.00 could display as: "This Braeburn apple costs $3.00".