RobertP
4th November 2011, 08:29
Hi, I have a basic problem which is quite simple but I just can’t get it to work.

In a form type 2. Several records have been saved. The last field on the form is a table field of type tcyesno (checkbox).

Step 1 - If the user clicks it yes, then I want the program to automatically save the changes. In the "when.field.changes" section I execute(update.db). In debug, I find that execute(update.db) resets the field value to No! This is the current table field value. Seems like execute(update.db) is actually doing a execute(recover.set)

Step 2 - then execute another function (gen.scm) to generate additional records (on the same table). This function works perfectly if the user manually "saves" the record on step 1 and then executes the function gen.scm from "specific" menu

So, in a form type 2, is user tabs past last field on form, how to auto save the record before proceeding?

Quite a simple but frustrating problem!
Thanks in advance
Robert

mark_h
4th November 2011, 15:46
According to the help on execute:

Note

For a list of all standard commands and the program types in which you can use them, see Standard commands.

Context

4GL library function.
You can use this function in 4GL scripts only. You can use it in the following event subsections:

before.choice, on.choice, after.choice
init.form, before.form, after.form, on.entry

You cannot use the function in the after.choice section of choice.update.db.

Doing some checking it seems every place I use it is a choice type section. I can't recall, but I think in one multioccurence session when they insert a new row in the choice section of add.set I execute(update.db) after each row. Check to see if they tab past the last field to start a new record that add.set is not executed - I think you can do it there in the before.choice.

RobertP
11th November 2011, 12:11
Thanks Mark,

I solved the problem by calling a function in do.occ()

In the function I first called update.occ() and then execute(update.db) as well as managing the marked record, it all works perfectly, andno messages about "records mod by other user, new values are displayed"..

:)