Calculated fields versus methods

Hi,

I would like to know what is better: calculations in fields stored or these calculations made by methods joined in an event onRecordSave.

Regards,

Carles Barbal

Not better I think. More a matter of how you like to work, again, I think.

I try to avoid calculated fields where possible because it gives me the feeling I have more control. It gives a little more flexibility over the content and use of a column value because you (or the user) can alter the contents where a calculated field can not be altered by the user or whatever method.

Hi Marcel,

In Servoy Developer User’s Guide pag. 136, it says:

When you create a stored calculation, it is not immediately calculated for all rows in a foundset. To force an update of the stored calculation value in all rows, you can use this loop:
for(var i=1; i<= controller.getMaxRecordIndex(); i++)
{
controller.setSelectedIndex(i);
}

I dont know if Servoy always calculates in List view or Table view, no matter if the values of fields keep the same. If this was the case, calculations made by methode would be more efficient.

Regards.

Carles Barbal

Exactly

When you create a stored calculation

.

So not when you use them. This only refers to ‘fresh’ calculations or re-created calculations.

Marcel,

Thank you very much for the explanation.

Regards,

Carles Barbal