Calc. value in sales header

I want to calculate some value in sales header (Margin value, %) from sales lines. The form for calculation is complex, therefore I can not use Flow Fields. I defined the calc. function in Sales Header table, and I call it from On Modify trigger in Sales Lines. If I set range for sales lines and go through them, then on the line, that was changed I get old value. I tried to use commit or selectlatestversion, but it did not help. Has anyone solved similar problem? Thanks Michal

Sorry. Not possible. The subform don’t know that it’s really a subform.

You could pop-up a separate screen.

I had some similar problems and i solved i by setting the calculated field in the Sales Line record and not in the sales header ! Then the calculation is always up to date when changing the sales line ! In the sales line its possible to get the sales header if needed ! The calculated value showed i on a frame on the bottom of the subform with sourceexpr rec.calcutedField. I hope this helps you out Kurt Juvyns Navi Freak

The problem is that when your code is running (in the OnModify trigger), the record in the database is not yet updated (Navision will write the record after OnModify trugger will finish without an error). Just put MODIFY statement in the beginning of your code. Best regards, Otto Dreyer NRG Ltd.