I Show the data via a dbgrid when I update qte or price the field MNT does not !!!Did you update/refresh the dbgrid dataset after the update?
Looks like OP found his answer over on stackoverflow.
https://stackoverflow.com/questions/73354332/the-database-calculated-field-not-updated-for-example-total-qteprice-when-qte
OK, the answer to what he wasn't asking was "you should re-select". But if he wants to do that automatically he should use an async notification, which has the benefit that any subscribed system will see it and know that the app should reselect and redisplay.Isn't that what TDataSet.RefreshInternalCalcFields is supposed to do?
RefreshSQL can be used to specify a SQL statement that is executed after an UPDATE or INSERT operation. The query will be executed, and the values of all fields in the result set will be copied to the dataset. This SQL statement is only executed during the ApplyUpdates operation, not during the Post call itself.
Using a async notification is also possible but is highly depended on the database and would be somewhat harder to implement.
I Show the data via a dbgrid when I update qte or price the field MNT does not !!!Not sure which database access components that you are using. If you are using IBX then a row containing a computed column should be automatically refreshed after you post the row.
If you let IBX generate/suggest the Update SQL then it will normally add a Computed By column to the returning clause of an Update statement e..gUnless you have multiple COMPUTED fields in which case "returning" doesn't work :D
Update MyTable Set A= B where key = C returning MNT;
That way IBX avoids having to separately refresh the row and the update statement automatically returns the updated computed by column value.
Why? Update ... Returning can return multiple columns - as can Insert returning.If you let IBX generate/suggest the Update SQL then it will normally add a Computed By column to the returning clause of an Update statement e..gUnless you have multiple COMPUTED fields in which case "returning" doesn't work :D
Update MyTable Set A= B where key = C returning MNT;
That way IBX avoids having to separately refresh the row and the update statement automatically returns the updated computed by column value.
Does IBX call RefreshSQL automatically in this case or does it need to be called manually?TIBCustomDataSet.InternalPostRecord contains the logic for this.
(If IBX detects there are multiple COMPUTED fields it could be called automatically upon Post)
Aaaargh. I missed that one. I thought RETURNING was for one field but you can indeed return multiple values.Unless you have multiple COMPUTED fields in which case "returning" doesn't work :DWhy? Update ... Returning can return multiple columns - as can Insert returning.
Good to know.Does IBX call RefreshSQL automatically in this case or does it need to be called manually?TIBCustomDataSet.InternalPostRecord contains the logic for this.
(If IBX detects there are multiple COMPUTED fields it could be called automatically upon Post)