When I insert a row from a table A, this table have an event OnRecordInsert. This method jump and insert a row in another table B who has stored calculation from an aggregation of table A.
At the event AfterRecordInsert in the table A have:
databaseManager.recalculate(the record from the A table)
databaseManager.saveData()
databaseManager.recalculate(the record from the A table)
databaseManager.saveData()
When you do that the first time works well but the second time not. When I say that it works well is that the calculation stored from the table B is store in the data base.
All the time I am checking the data base.
And with the debug I check the record who have to be stored and is perfect, I can see the correct value at the calculation stored, but when pass the saveData it didn’t stored at the data base.
The most strange think is when you close the program it store.
You can see at the example:
It compose with 3 table (order_tbl, order_tbl_dtl, tax), and a process create_tax() who is in onRecordInsert and onRecordUpdate, and in the method afterRecordInsert and afterRecordUpdate I save the record.
To see the problem,
-inset a row in order_tbl save it,
-insert a row in order_tbl_dtl an write the order_tbl_id (put the number of the one who you save it before), price, tax, and unit. Save it
-insert another row from the same table change put a different tax from before
You have to check the table tax at the data Base.
I need that this row have to be stored because it depend on another table.
Probably I need to use a different function to refresh the record to the data base, but I ignore it.
example.servoy (9.83 KB)