When are formulas recalculated ?

 Problem

I got a grid which is using col.xyz.formula to calculate a number of columns. When I update the underlying data, the formulas are not updated.
Why ?

 

Reason

The formulas are only calculated when the values in the dependent columns are changed.
If, for instance, the formula depends on a list value, and the associated list value is changed due to an underlying database change, the column value will be correct only after visiting the grid and refreshing the value.

 

Assume a configuration

gd.columns = product, price, quant, total ...   col.product = Product col.product.type = list col.product.query = select product, sku, price from products col.product.query.ds = erp ...   col.price = Price col.price.type = number col.price.formula = {product.price} ... col.total = Total col.total.type = number col.total.formula = {product.price} * {quant} ...  

The price in the grid will not be updated when the price in the products is modified.

 

Workaround


This can be resolved by implementing database triggers which detect the change in the products database, and ripple it trough to the grid table.
Check your database admin for more information on how to create database triggers.

 

 

 

Â