We use cookies to improve our service. Learn more.

Reference / Computed Columns

Math Column

Perform instant calculations using the data in your projet.

The Math Column allows you to perform instant calculations on the data in your table from basic arithmetic functions to more complex ones.

You can then bind the formulas in your column to different Components in your app and see the output instantly.

Configuration

Once you've added the Math Column, you need to configure your calculation or formula. As you start typing in the Configuration field, Glide will guess which column you are referring to and add a new replacement field.

This means you don't have to use the full column name in your calculation. For example, instead of using the formula:

(Annual Salary Package)/12

you could just write: AS/12 and then use the replacement fields to tell the Math Column what AS refers to:

You can reassign your replacements to different columns whenever you like:

Supported calculations

The Math Column works with the following calculations:

+ADDITION -SUBTRACTION *MULTIPLICATION / DIVISION ^ EXPONENTIATION () PARENTHESIS

And the following functions e.g. LOG() or ABS()

  • LOG
  • ABS
  • MIN
  • MAX
  • FLOOR
  • CEILING
  • ROUND
  • TRUNC
  • ASIN
  • COS
  • ACOS
  • ATAN
  • MOD
  • SECOND
  • MINUTE
  • HOUR
  • DAY
  • WEEKDAY
  • MONTH
  • YEAR

The Math Column only accepts the above symbols. It will throw an error if you try to use another symbol.

Date & Time Math

The Math column can also do calculations with dates & times. For example, subtracting two date/times produces a duration.

In the image above, you can see that Glide also gives us access to a Now value that we can use as a substitution for a variable. This makes it easy to work out the time until something or how long ago something was.

  • Now - Date will give you how long ago a date is (if that date is in the past)
  • Date - Now will give you how long until a particular date (if that date is in the future)

The value that is output is a duration. If you want to round the duration value to just days, you can use math.floor(). For example:

Adding a duration (number) to a date/time, or subtracting it from a date/time will add/subtract that many days to it and you can also pick “Now” as a substitution for a variable.

Updated 5 days ago
Was this helpful?