spartacus
3rd February 2003, 15:22
Strange!!

I use a user function to change the value of a main table field.
If I press previous, or next.set button, this value is not stored in table. Also the before.write, or before.rewrite isn't executed.

If I change the field value manual (not by user function) it works. If I switch to the next set, and then back, the field value stays changed, the main.table.io section ist passed.

I think this prob is somehow related to the update.status.

How can I store a value in the main table, if I use a user function for update?

Thanks
Spartacus

evesely
3rd February 2003, 16:15
Have you tried calling update.occ() after changing the value? This is supposed to tell Baan that you have changed a main table field and it should process the table changes when necessary.

spartacus
4th February 2003, 09:35
Hi Evesely,

thanks for your advice!
No we didn't try "update.occ". We tried "update.db". Is there a sence in trying "update.occ" on a single occ form?

Spartacus

Youp2001
4th February 2003, 13:52
Yes it makes sense to use update.occ(). See the text from Baan tools helpfile:

The 4GL engine automatically detects changes a user makes to a field. However, it cannot detect changes to field values made in the program script. When you modify a field of the main table in the program script, you must call update.occ() to switch on the update.status flag of the 4GL engine. This ensures when that the database is next updated, the modifications are saved to the database. The database update action can be initiated either by the user or within the script (use execute(update.db)).

If you use update.occ and you do any action i.e. next set application will automatically execute update.db because update.status is set.

Youp

spartacus
5th February 2003, 09:30
Hi Youp2001,

thanks a lot, for the explanation. That realy helps a lot.


Spartacus

wgarcia
26th July 2003, 20:08
for type 1 form you must work with do.all.occ(), create a new function in wich you must use update.occ() command. In this function the [execute(update.db)] clause must been execute.

example:

baan code:

choice.cont.process:
after.choice:
do.all.occ(update.rec)


functions:

function update.rec()
{
update.occ()
tccom000.nama = "new value "
execute(update.db)
}