Stored and unstored calculations...

I have been reading about stored and unstored calculations.

Can someone help me to get a clear picture on when and why to use either one or the other?

Also, when I have a calculation using 10 dataproviders (also using relationships) and something like 40 or 50 different conditions (also using relationships). Would I then use a calculation or is it better to use this as a method attached to the onDataChange event of the dataproviders that are subject to change and input for the calculation…

BTW I now use a method to do the trick…

there are 3 reasons to use stored calcs:

  1. calc function is very expensive, better store result for future use
  2. sorting needed on calc results (this is not elegant, better prevent this)
  3. external applications (like cristal reports) need access to calc results (like order total)

Thanks jan!

Jan Blok:
there are 3 reasons to use stored calcs:

  1. calc function is very expensive, better store result for future use

Fair point. But how does Servoy know when the calculation needs to be redone (updated), without doing the “expensive” calculation?

Jan Blok:
2) sorting needed on calc results (this is not elegant, better prevent this)

Not sure I follow. Borrowing from your next example, is there an issue with wanting to sort on say order total?

Jan Blok:
3) external applications (like cristal reports) need access to calc results (like order total)

I.e. by storing the result of the calculation other apps don’t need to know about the details of the calculation?

Thanks,
Neale.

  1. calculations are at least (re)calculated if one of the imputs is changed
  2. we leave sorting to the database so if something is not in the database it cannot be sorted.
  3. yep