Computed Fields

Automate calculations and dynamic content generation


Computed fields

automatically generate values based on data in other fields.

They help you perform calculations, format dynamic text, and calculate dates or selections without manual input - similar to spreadsheet formulas.

This guide explains each computed field type and shows you how to set them up.

Computed fields enable you to:

Perform Calculations (Computed Number):
  • Calculate & perform arithmetic on your fields, use exponentials, unit conversions & more.
  • Example: $FIELD_1 * ($FIELD_2 + $FIELD_3)
    BIDMAS & standard mathematical grammar applies.
Create Dynamic Text (Computed Text):
  • Build messages or descriptions by inserting field values into templates.
  • Example: "Order for $CUSTOMER_NAME totaling $$AMOUNT" might display as: "Order for John Doe totalling $150.00."
Calculate Dates (Computed Date):
  • Automatically compute dates or durations.
  • Example: $START_DATE + 30 Days adds 30 days to a start date.
Select Options Automatically (Computed Select):
  • Determine an option based on other field values.
  • Example: IF($PRIORITY > 5, "High", "Normal") chooses a select option based on the priority field.
Lookup Fields
  • Lookup Fields copy values from a record in a linked collection , avoiding data duplication.
Aggregation Fields
  • Aggregation Fields summarise data (e.g., sum, average, count, minimum, or maximum) from related records in a linked collection.

How to Create a Computed Field

1. Open the Collection

  • Select the collection from the sidebar.


2. Go to 'Configure'

  • Click the ⋯ (options menu) in the top-right corner and select Configure, or
  • Right-click on the collection name in the sidebar and choose Configure.


3. Select 'Fields'

  • Under setup, click 'Fields' to see all existing fields.

You'll need Configure permissions

to adjust collection settings. If you're unsure, ask your System Admin.


4. Add a Computed Field

  • Click “+ Add Field”: Start adding a new field.
  • Select the Field Type: In the Type dropdown, choose one of: - Computed (Text) - Computed (Number) - Computed (Date) - Computed (Select) - Or choose Lookup/ Aggregation for relational data.
  • Enter a Field Name: Provide a meaningful name (e.g., 'Total Cost' or 'Order Message').

For more detail on the different types of field you can use in Kinabase, see our guide on Field Types.


5. Write Your Formula or Template:

Kinabase has lots of different operations and functions you can use in computed fields.

Using Field References:
Reference other fields by using the $ symbol followed by the field name in ALL CAPS (replace spaces with underscores). Example: For a field named "Price", use $PRICE.

Arithmetic Operations:
Use +, -, *, / with spaces around operators for clarity. Example: ($PRICE * $QUANTITY) - $DISCOUNT

Rounding Functions:
There are 3 functions to round numbers:

  1. ROUND($FRACTION) - Rounds to the nearest integer: ROUND(4.7) = 5
  2. FLOOR($FRACTION) - Rounds down to the nearest integer: FLOOR(4.7) = 4
  3. CEIL($FRACTION) or CEILING($FRACTION) - Rounds up to the nearest integer: CEIL(4.2) = 5

Absolute function is also supported, use ABS($NUMBER) to return the absolute value of a number. Example: ABS(-10.2)=10.2

Exponential Operations:
Use the caret ( ^ ) to raise a value to a power. Or type LOG(value, base) for any logarithms; for natural log, or use “LN”
Example: $REVENUE ^ 1.07 or LOG($VOLUME,10)

Trigonometric Functions:
Use SIN(), COS(), and TAN() for trigonometric calculations. These functions require input in radians. To convert from degrees to radians multiply the value in degrees by PI/180.
Example: SIN($ANGLE), SIN(PI/6) = 0.5

Conditional Logic:
Use the IF function for conditional output. Syntax: IF([condition], [result if true], [result if false])
You can use these operators in your conditions: = (equals), != (does not equal), < , > (less and greater than), <=, >= (less and greater than or equal to).
Example: IF($COST > 100, $COST * 0.9, $COST) applies a discount for high costs.

Boolean Logic:
With conditional logic you can also use boolean operators:

  • and - All conditions must be true.
  • or - At least one condition must be true.
  • not - Inverts a condition.
  • xor - One condition must be true, but not both.

Handling Empty Values:
Use the ?? operator to provide fallback values when a field is empty.
Example: $DISCOUNT ?? 0 returns 0 if the discount field is null.

Introducing Units:
You can use units from measurement fields in your calculations. Just append the unit symbol to the number or field reference.
Both SI and Imperial units are supported. Currency symbols are also treated as a unit.
Example: $AREA * £400,000/ha Calculates the cost of an area of land.

Temperature Conversions:
Convert temperatures between different units.
Example:kelvin(), celsius() or fahrenheit() These functions will convert a temperature value to the named unit in the function. This can be useful when doing calculations using temperature as all calculations are done in Kelvin.

Computed Text:
Combine various text fields into a computed sentence.
Example:"Order for $CUSTOMER_NAME totaling $$TOTAL_AMOUNT" This template combines static text with dynamic field values.


Subfields:

Some field types have subfields you can access in computed fields or expressions using the syntax $FIELD_NAME.SUBFIELD_NAME.

  • Text length Within a Computed Number field you can use the .LENGTH function to return the number of characters in your text field.
    Example: $FIELD_NAME.LENGTH You can then perform arithmetic on this text-length value.

You can also use CHARACTERCOUNT($FIELD_NAME) in your expressions to return the character length of the string field. Please note: Special characters may throw this value off

  • Risk subfields: For the Risk field, you can access IMPACT and LIKELIHOOD subfields to get the individual scores for these aspects. Example: $RISK_FIELD.IMPACT returns the impact score of the risk field.
  • Address subfields: For Address fields, you can access address lines such as CITY, COUNTRY, POSTCODE, etc.
    Example: $ADDRESS_FIELD.CITY returns the city from the address field.
  • Start and End Dates: For Date Range fields, you can access START and END subfields which can be used. Computed date fields have a streamlined process to make accessing and using these subfields easy.

6. Save The Field

  • Click 'Add Field' Your computed field is now saved. It will automatically update whenever the referenced fields change.


Tips for Using Computed Fields

  • Create test records to verify that your computed field returns the expected value.
  • Use parentheses to ensure operations occur in the correct order.
  • You can nest functions and operators for more complex logic.
  • Always reference fields in ALL CAPS with underscores replacing spaces, e.g., $FIRST_NAME.
  • In numeric computations, include units if needed (e.g., $MILEAGE * £3.50/mi).

By mastering Computed Fields, you can automate calculations and dynamic content generation within your Kinabase collections - streamlining data entry and ensuring consistency across your records.

If you have questions or need further assistance, our support team is here to help.