Hi
With have a different behaviour with the client and the client started from the developer. Looking at a common situation of an 1:m relation like persons having 1:m roles. When we create a new record in table persons and open a dialog to add persons values, also the roles table values, the behaviour when started from the developer is (seems to be) correct. That means, the popups for selecting a role and the popup for selecting a status are empty. Doing the same thing on the client, the popups for roles and status are randomly preset with some values of roles (for a person), because, as we found, there seems no new record created for the roles table when using the client compared to using the developer client.
Here is the method:
function onActionInsert()
{
databaseManager.setAutoSave(false); // Transaction start
controller.newRecord();
discriminator = forms.BasConfiguration.getConfiguration().naturalPersonDiscriminator;
application.showFormInDialog(forms.PerDialogAddPerson); // Open the dialog modal
databaseManager.setAutoSave(true);
if (forms.PerDialogAddPerson.wasSaved)
{
// Sort the list and select the new record
var selectedPerson = id;
// foundset.sort('name asc'); // The sort removes the inserted record, why? It seems to somehow loose the correct previous sql command which is reapplied for the sort (Servoy internally)
// Select the new person
for (var i = 1; i <= foundset.getSize(); i++)
{
if (foundset.getRecord(i).id == selectedPerson)
{
foundset.setSelectedIndex(i);
}
}
}
}
Regards, Robert
By the way, as we found earlier and already reported, the foundset.sort() removes the record from the display! It “reappears” if changing the form and coming back.
can you test the foundset/record from forms.PerDialogAddPerson a bit before showing the dialog??
var record = forms.PerDialogAddPerson.foundset.getSelectedRecord()
record.role?
record.pk?
By the way, as we found earlier and already reported, the foundset.sort() removes the record from the display! It “reappears” if changing the form and coming back.
what do you mean by removes? its not selected anymore? But it is still in the foundset?
calling sort() on a foundset that has unsaved changes that cant be saved (auto save off) will not even work/shouldnt do anything.
The behaviour of the client is very confusing, as it sometimes shows on newRecord() data from related tables randomly, or at least we can’t figure out any logic behind it.
But, as a result of this behaviour, the record can’t be stored, as some relations point to existing data, although it should not do that.
Sorry I can’t be more precisely, but we are fighting this problem for some days now and not being able to get a clearer picture. The client started from the developer works correctly (or at least it we did not have the problems as in the smart client).
jcompagner:
can you test the foundset/record from forms.PerDialogAddPerson a bit before showing the dialog??
var record = forms.PerDialogAddPerson.foundset.getSelectedRecord()
record.role?
record.pk?
This is not the problem like the one having an empty foundset. This problem occurs whene entering a new record into a table, having (as described above) some relations to other table. On entering the record with foundset.newRecord(), the records (in debugger) is displayed as it should in the list (a tbale view form). As soon as the foundset.sort() is executed, the record dissappears from the list, althoug it is still there. Of course clicking on another menu and coming back “brings” back the inserted record into the list as well.
Hope this gives an idea, Robert
jcompagner:
By the way, as we found earlier and already reported, the foundset.sort() removes the record from the display! It “reappears” if changing the form and coming back.
what do you mean by removes? its not selected anymore? But it is still in the foundset?
calling sort() on a foundset that has unsaved changes that cant be saved (auto save off) will not even work/shouldnt do anything.
i have no idea what this an be
But did you try out the code i mentioned above??
Please output the pk and other record data of the new record from the foundset of the form you are showing in the dialog
Right before you show the dialog
You can use application.output() that should go into the Webstart console for a real client.
Hi Johann
Birgit found the problem. The sequences on the application server were for whatever reason completely messed up. After updating sequences for tables the expected behaviour returned to the client. Sorry for consuming your time! It’s still a bit frightening for us how this could happen.
The second problem with the foundset.sort() still remains. The problem occurs only in (table view) forms which are filled with an SQL statements. If a record is added to a list which show just the table content, the problem with the sort() does not occur.
Thanks and regards, Robert
jcompagner:
i have no idea what this an be
But did you try out the code i mentioned above??
Please output the pk and other record data of the new record from the foundset of the form you are showing in the dialog
Right before you show the dialog
You can use application.output() that should go into the Webstart console for a real client.