Strapi: Add a formula field

Created on 14 Apr 2019  路  3Comments  路  Source: strapi/strapi

It is quite a standard feature on many CRM (saleforce, neolane,...).
It can be very flexible and useful for many things.
A formula field store a formula on metadata but nothing is stored in DB.
The formula is based on record fields and is calculated on the fly when api query this field.
potential use case:
with function:

  • dateonly(mydate)
  • urlized(myTitle)
    -DaysAgo(myDate)
    -If(IsClosed;'Closed', 'Open')
    or just operations:
  • TotalWithTaxes = TotalHt * VAT
  • Cost = Price + shippingFee
  • Surface = width * Height
low feature request

Most helpful comment

Yes, yes and yes! I've added it to the public roadmap, it could be awesome to have this new type of field available.

https://portal.productboard.com/strapi/c/58-formula-field

Please upvote the card and give me your insights, I close the issue.

All 3 comments

Yes, yes and yes! I've added it to the public roadmap, it could be awesome to have this new type of field available.

https://portal.productboard.com/strapi/c/58-formula-field

Please upvote the card and give me your insights, I close the issue.

For that, you will need a little language with formula editor and a list of function. You can take look to salesforce editor here:
https://trailhead.salesforce.com/en/content/learn/modules/point_click_business_logic/formula_fields

Directus uses some kind of "in-field templating" e.g. for the content of a dropdown like:
{{brand.name}} {{title}}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

quibaritaenperdresatrompe picture quibaritaenperdresatrompe  路  3Comments

peeomid picture peeomid  路  3Comments

GreenGremlin picture GreenGremlin  路  3Comments

doublemarked picture doublemarked  路  3Comments

derrickmehaffy picture derrickmehaffy  路  3Comments