Formula field

Issue Plan

MR Group 1

These issues will be opened as separate MRs into a Final MR to be merged into develop as a group:

  1. #586 (closed) Add basic text formulas
  2. Add support for:
    1. Text concat operator
    2. referencing other text fields (the field function)
      1. Can't reference unsupported field types (anything but text fields to start with)
    3. referencing other formula fields
      1. Can't do circular or self references
      2. When a referenced formula field is updated, needs to update the nested formulas in all dependant fields and trigger a data update for all users in realtime
    4. numeric type and related functions
      1. This being the second type, type checking needs to be added, functions need to have argument and return types, these need to be evaluated and checked if allowed
    5. Add type casting functions
      1. Must ensure that casting failures don't turn into actual database errors but instead just mark the cell as in an ERROR state
    6. extract functions, maybe operators etc into registries
    7. boolean type and related functions (case, IF, etc)
    8. date type and related functions
    9. add record types/functions (ROW_ID, LAST_MODIFIED_AT etc)
  3. Add the autocompleting/resizing/doc providing formula editor

MR Group 2

These are extra features which are not required for the v1 release and will be grouped into a separate final MRs.

  1. Add as you type formula errors/warnings from the backend
  2. Add frontend type checking
  3. Add frontend validation
  4. Add frontend interpreter for text only formulas

Future Features not yet grouped/prioritized

  1. Add per type specific formula field formatting. E.g. you can say output this field in this datetime format if the formula is of a datetime type etc.
  2. Formula fields in form views
    1. Could let users create dynamic feedback in forms if formula fields updated in realtime/quick enough and were shown in the form view in a read only fashion
    2. Could let users create custom validation logic for forms by marking a boolean formula field as "required" meaning that the form could only be submitted if and only if that formula field evaluates to true
  3. Importing other formula languages
    1. Hopefully in most cases this will be a trivial function name mapping, but i'm sure there will be a ton of edge cases and oddities
Edited by Nigel Gott