Skip to content

v1.0.0

Latest

Choose a tag to compare

@novaxpro novaxpro released this 28 Sep 15:48
· 1 commit to main since this release

Formula Columns v1.0.0

A big update of the Formula Columns plugin. Until now, writing a formula meant writing it blind, committing the data model, editing a record and hoping for the best, and when it failed you got "the plugin caused an error" without knowing which of your formulas broke. This release fixes both.

Test a formula before committing anything

The formula editor has a new Test tab. Pick a real record (or use a generated demo record), change the values you want to try and press Run formula (or Cmd+Enter / Ctrl+Enter):

  • Formula output: the value the column would get and its type, everything printed with console.info / console.log, the log, the run time, and the error with its stack if it failed
  • Resulting record: the record as it would be saved

Nothing is saved and the data model does not have to be committed. It also works for columns that are saved but not committed yet, and for nested tables (one result per row).

Errors on the right field

A formula that fails now rejects the save and marks its own field in the editor. The message is listed under "Save not possible › Details":

Formula column person.demo_parity failed: Error: 7 is odd, please enter an even number

With ten formulas on an object type you see right away which one broke, and why. And since the message reaches the editor as it is, a formula can validate input: throw an Error with a message for the person saving the record.

New formula editor

  • three columns: documentation, code / test, output / resulting record, each one scrolling on its own
  • the documentation can be collapsed, like the quick access
  • the help starts with what a formula returns: the value of its own column, in the format of the column type
  • modern JavaScript like 1_000_000 is no longer flagged as a syntax error
  • help texts in English, German, Spanish, Danish and Finnish

⚠️ Behaviour change

Before, a formula that threw an error was swallowed: the record was saved anyway and the column kept its old value. Now the save is rejected. If you have formulas that fail for some records, check them before updating. You can catch the error in the formula and return a fallback (see "Failing softly" in the README), or switch the formula off with "Disabled".

Requirements

  • fylr 6.34 or newer
  • testing a formula requires the system right system.datamodel, the same people who can commit one

Get it

Install or update from the plugin manager, or download the zip:
https://github.com/programmfabrik/fylr-plugin-formula-columns/releases/latest/download/fylr-plugin-formula-columns.zip

The README has a quick start (5 minutes, the example above) and many more examples: https://github.com/programmfabrik/fylr-plugin-formula-columns#readme