# Add support for programmatically triggering formula fields to evaluate

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!

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!

Tagged:

6

#### Categories

- 7.9K Questions
- 918 Ideas
- 219 Discussion Categories
- 177 General
- 9 Community Feedback
- 3 Community Info
- 17 Knowledge Base

## Comments

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

Don

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.