Hello, we found a very strange behaviour when using transaction while navigating from portal to corresponding formInDialog.
Servoy seems to loose the foundset to the portal as soon as the formInDialog is invoked with a transaction (see code examples below).
At that point we found a workaround by saving the foundset before and restoring it after the transaction ends (either commit or rollback).
Are you aware of this behaviour?
Details:
On the resource form, we have a portal to communications, by clicking on a button, we open a formInDialog to communication (code a).
(Code a)
forms.rCommunications.controller.loadRecords(rr_to_rc);
application.showFormInDialog(forms.rCommunications,200,200,440,150,'i18n:GLS.rResources.wTitle.Communications',false,false,false);
After having added transactions, the same code only points once to the correct related record, all subsequent calls opened the formInDialog, but showed the first record of the communications table, regardless of the line clicked in the portal, until we changed from one record to the other in the parent table (resources), or reloaded the found set:
(Code b)
forms.rCommunications.controller.loadRecords(rr_to_rc);
databaseManager.startTransaction()
application.showFormInDialog(forms.rCommunications,200,200,440,150,'i18n:GLS.rResources.wTitle.Communications',false,false,false);
var hasTransaction = databaseManager.hasTransaction();
if ( hasTransaction = true ) // no commit nor rollback was issued in dialog
{
databaseManager.rollbackTransaction();
}
Finally, we found a workaround by writing:
forms.rCommunications.controller.loadRecords(rr_to_rc);
var theFoundset = currentcontroller.duplicateFoundSet();
databaseManager.startTransaction()
application.showFormInDialog(forms.rCommunications,200,200,440,150,'i18n:GLS.rResources.wTitle.Communications',false,false,false);
var hasTransaction = databaseManager.hasTransaction();
if ( hasTransaction = true ) // no commit nor rollback was issued in dialog
{
databaseManager.rollbackTransaction();
}
currentcontroller.loadRecords(theFoundset);
The called form has separate foundset attribute on. Is this a bug or should we always save and restore foundsets when using transactions?
Have a nice day,