Correct use of CALCFIELDS

It’s related to the flow field again. Say, I am in a Volume field (of table A) and make a change. This volume field is a flow field to another table (B) which is used to calculate its amount field (in table B). This amount field in table B is them flow field to the master record. I am having trouble updating all these fields in their table correctly. The reason being: all the validate or CALCFIELDS code that I put behind the Volume field OnValidate in table A is actually using the xRec values because the changed value is not saved until I closed the form (a line item form). The only solution that I could think of is to put the CALCFIELDS and Validation code in the OnQueryClose of the form when the edited record is actually updated in the table. Again, we try not to put code behind forms, so I am trying to find a better way to accomplish this task. Any ideas? Please.

Please state the actual subject in the subject field and not just URGENT and remember that everyone here are doing this for free and just to be nice and help. Subject line changed.

Hi, try to put your code in the OnAfterValidate() - Trigger of the TextBox which belongs to your volume field on that form. Micha

quote:


Originally posted by Micha: Hi, try to put your code in the OnAfterValidate() - Trigger of the TextBox which belongs to your volume field on that form. Micha


Thank you for your time in helping me. I think I got it. If I put the MODIFY in OnValidate of the Volume field, then all subsequent CALCFILELDS & VALIDATIONS in table B will reference my latest changes instead of using the old record values. However I will keep your idea in mind since I haven’t tried the AfterValidation trigger. :slight_smile: Thanks again.

Try to use OnAfterGetCurrRecord(), OnInsertRecord(), OnBeforePutrecord() triggers. But… see any ‘Invoice’ form: this form doesn’t contains any totalling fields because imposible to show correct values for flow-fields in some cases (example: flow-field is based on subform’s data). All totals are in another ‘statistics’ form (F9). Business Applications Programmer Sertified Navision Developer SIA “Sintegra” Latvia

Alexei is correct about totals on invoices in Navision but you can actually have your totals on the subform so they can be updated with changes on the subform. I would use some code simular to the totals on the general journal line totals, but make it a bit more robust, so that totals are always calculated. Paul Baxter