The 4gl engine will set a flag that the database needs to do a save whenever you have modified a field on the form. When you don't modify a field, but change a table value in the code, you need to call update.occ. to set the flag manually.
What this means is that you should be able to put your function call in a when.field.changes: subsection and it will work if you change a field value to something new.
Do you want to update the value any other time?