Updating Calcs

Hi all

I have a dabase with an inventory table and related lineitems table pretty standard stuff.

There are a number of calculated fields in both tables some stored. When i run inventory reports the calc fields (even unstored) are not updating with any new related line item info.

If i visit the detail inventory form (contains all relevant colums) everything recalculates and then if i run the report everything is accurate. I want to make sure all calcs in the inventory table (stored and unstored) are updated before i run finds and these reports. I am aware of a recalculate function and have tried using this in a method. but doesn’t seem to be doing anything except slowing down the report ie.

forms.inventory_detail.controller.loadAllRecords()
databaseManager.recalculate(foundset);

Any ideas?

If i view/update the inventory with a method every time i make a line item change then this should be ok but it sort of defeats the purpose of calc fields in the first place!

Sort of worked this one out.

The problem was coming from changing a value in a purchases table which changed some line item values and didn’t update their related inventory values. Fixed this by using an ondatachange method to loop through the relevant line items and force them to evaluate the related inventory values by assigningthese values to variables in the method.

Testing this now but seems to be fine so far.

This is something to really watch out for however. Updating calc values in a table 2 relationships away!