Add support for programmatically triggering formula fields to evaluate

  • 6
  • Idea
  • Updated 5 months ago
  • (Edited)
Currently, there is no officially supported way to force a formula to re-calculate.  Coupled with the fact that there are several scenarios that should result in formulas automatically re-calculating but do not, providing an officially supported way to force them to re-evaluate would help close this gap.

For example, let's say Model A has a formula field that uses MODEL_LOOKUP to Model B.  When Model B changes, the formula field on Model A does not update.  Ideally this would occur automatically but by providing a way to force a re-calc, model events could be hooked on Model B to programmatically force Model A to re-evaluate formula fields.  This issue will become even more prevelant with the introduction of custom formulas.

The "Ask":

1) Document skuid.model.Model.evaluateFormulaFields - This evaluates all formulas in all rows for a given model
2) Document skuid.model.Model.evaluateFormulaField - This evaluates a single formula field on a specified row
3) Add support for forcing evaluation of formulas on an entire row - This would evaluate all formula fields on a specified row

Thank you!
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb

Posted 2 years ago

  • 6
Photo of Don Souza

Don Souza, Employee

  • 1,160 Points 1k badge 2x thumb
Hi Barry,

I'll pass this along, and thanks for the suggestion.

Don
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Thanks Don.  There's been several different cases recently in the forum where skuid customers could really use this functionality.  People are using it in an unsupported way which is never ideal so hopefully official support can be added soon.  Thanks again!
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Yes Yes Yes!

Also, thanks for mentioning .evaluateFormulaField(), Barry. That should save a lot of processing time on some of our pages.


If I may add #4, while we're at it?

4) support for forcing evaluation of a single formula field (and any dependents) on all rows in a model.


Perhaps the row argument in skuid.model.Model.evaluateFormulaField could be optional, and if left blank would evaluate the specified formula on all rows. Similarly, skuid.model.Model.evaluateFormulaFields could allow an optional row parameter which would fulfill the Barry's request in #3.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Nice thought on #4 Matt, completely agree!
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Any progress on this, skuid?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
bump