Updating stored calcs

Hi

What is the preferred technique to update related stored calcs?

Example: if i have a number in a parent record and child records use this value in their stored calcs.

If i update the value in the parent record the child records will update if i load/view the child record, fine. if i update the parent record and their are 10,000 child records that need to update how do i make sure these have recalculated without loading each.

Currently i am looping through the child records (on datachange method) and loading the stored calc in a variable to force the recalc but this can be slow for large related record sets. Is there a better way? (database recalc function?)

Thanks,

Hi Rodney,

Look here:
//recalculates the record or all the records in the given foundset
//It can be needed in case records are inserted outside servoy
//please use with care, this can be expensive!
databaseManager.recalculate(foundset.getRecord(1));
//databaseManager.recalculate(foundset);

Regards,
Hans-Peter


Servoy Developer
Version 3.0-build 371
Java version 1.5.0_07-b03 (Windows XP)

Thanks Hans-Peter

Sorry for the late reply. Would the code to recalc the related child records be:

Example
databaseManager.recalculate(parent_to_child.getRecord(1));

rodneysieb:
Thanks Hans-Peter

Sorry for the late reply. Would the code to recalc the related child records be:

Example
databaseManager.recalculate(parent_to_child.getRecord(1));

No, you want to update all children so the code must be:

databaseManager.recalculate(parent_to_child);

Hope that helps

Thanks Harjo!

Works fine but is not exactly fast. Has this been improved in v3.0?