@directus-labs/calculated-fields-bundle

1.0.2 • Public • Published

Calculated Fields Bundle

Automatically calculate values based on other field values.

Currently only an interface is provided in this bundle. Values are only visible in the interface and not in API responses.

A number of examples showing how calculated fields can be used to derive values from other fields.

Features

  • Display a calculated value based on any number of fields of an item.
  • Supports the full set of functions provided by Formula.js.
  • Supports a majority of JavaScript operators that work for numbers and strings.
  • Use any M2O related fields in addition to root level fields.

Example Forumlas

Determine if a {{date_time}} field is in a leap year:

CONCATENATE(YEAR({{date_time}}), " ", IF(YEAR({{date_time}}) % 4 == 0, "is a leap year", "is not a leap year"))

Uppercase the value of a relational {{title}} field:

UPPER({{article.title}})

Package Sidebar

Install

npm i @directus-labs/calculated-fields-bundle

Weekly Downloads

71

Version

1.0.2

License

none

Unpacked Size

373 kB

Total Files

5

Last publish

Collaborators

  • rijk
  • bryantgillespie