RobertP
16th May 2023, 12:44
to.key() is giving odd results.

MMT session. One of the satellites loses focus after update.db. I found that to.key(2) is the cause.

So here goes the big question. In Dynamic session/forms, one can specify applicable indices and even give them a different numbering sequence (opposed to table index #). I have read all the programmers manuals (online/local on PC) and nowhere.

Does to.key(2) pick
--- table index #2 or
--- key of dynamic session index #2 as specified in session ttadv2101s000 "available indices by session"

Thanks

OmeLuuk
16th May 2023, 17:35
to.key() is giving odd results.
Known issue indeed, in aMMT session. One of the satellites loses focus after update.db. I found that to.key(2) is the cause.In your driver (main session) did you use in the after.form.read:
add.sync.fields.nokey("satellite1", "field.driver1", "field.satellite1", ..., "field.driverX", "field.satelliteX") to link and sync fields? For all satellites? In the group.1:
init.group:
enable.satellite("satellite1") ... for all satellites? Also I used after.display:
synchronize.satellite() and make.current
So here goes the big question. In Dynamic session/forms, one can specify applicable indices and even give them a different numbering sequence (opposed to table index #). I have read all the programmers manuals (online/local on PC) and nowhere.

Does to.key(2) pick
--- table index #2 or
--- key of dynamic session index #2 as specified in session ttadv2101s000 "available indices by session"
Thanks
The to.key picks the key as defined in the sessions so your second option.

What I did do in a similar case where I did a lot with key and satellite sessions, was adding these comments in the choice.update.db:
before.choice:
update.occ() | Trigger 4GL to perform update action.
| 4GL sets db.retry.point just after the before.choice
| Prepare updates in the "normal" flow and execute them in the
| after.choice section without extra retry points and commits. Just call
| execute(update.db)
after.choice:
| All additional update actions must be initiated through functions here
if g.do.update = 1 then | records from the driver and satellite session current
warn.outside.transaction = ""
on.main.table(actualize.driver.maintable, keyfield1, keyfield2)
g.do.update = 0
endif
| 4GL will perform the commit transaction after this section.

after.update.db.commit:
| now the STP commit has been done. New transactions must have their own
| db.retry.point() and commit.transaction().
| To avoid warning to extend the transaction time it is shown outside
if not isspace(warn.outside.transaction) then
mess("tcgenstring", 1, warn.outside.transaction)
if pos(warn.outside.transaction, "RESTART") <> 0 then
exit("RESTART")
endif
warn.outside.transaction = ""
endif
clean.mess()

RobertP
19th May 2023, 08:32
Thanks for the clear information OmeLuuk.