Record Validation - Update View After Failed Record

Forum to discuss the new web client version of Servoy.

Record Validation - Update View After Failed Record

Postby john1598360627 » Sat Feb 20, 2021 4:03 am

I'm trying to setup record validation and one behavior I noticed was something to do with the failed records.


So after an error occurs, the record gets put into the failedRecord queue right? In the actual database the record is fine. However, the view in the NG client still shows the failedRecord for the user.

Why is that? Is there a way to not show the failedRecord and just revert back to normal, well atleast for the users point of view. Does it have something to do with how the failedRecord queue works, or perhaps the foundset of the form not refreshing?
john1598360627
 
Posts: 169
Joined: Tue Aug 25, 2020 3:03 pm

Re: Record Validation - Update View After Failed Record

Postby swingman » Sun Feb 21, 2021 11:23 am

Is this with the new-style validation in Servoy 2020.12?
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1472
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Re: Record Validation - Update View After Failed Record

Postby sean » Mon Feb 22, 2021 10:03 pm

Hi John,

All records track their changes, keeping both the old value and the new value.
When a save fails, the default behavior doesn't revert the record. The record is, as it was before the save, and Servoy doesn't assume that you want to revert anything.

Failed records can be reverted programmatically, for example:
Code: Select all
if(!databaseManager.saveData()){
    plugins.dialogs.showErrorDialog('Save Failed');
    databaseManager.revertEditedRecords();
}


I hope this helps. if not, please share more about the desired UX.

Best,
Sean
Software Engineer
Servoy USA
sean
 
Posts: 370
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Record Validation - Update View After Failed Record

Postby john1598360627 » Wed Feb 24, 2021 12:19 am

sean wrote:Hi John,

All records track their changes, keeping both the old value and the new value.
When a save fails, the default behavior doesn't revert the record. The record is, as it was before the save, and Servoy doesn't assume that you want to revert anything.

Failed records can be reverted programmatically, for example:
Code: Select all
if(!databaseManager.saveData()){
    plugins.dialogs.showErrorDialog('Save Failed');
    databaseManager.revertEditedRecords();
}


I hope this helps. if not, please share more about the desired UX.

Best,
Sean


Thank you Sean!

I'm not using manual saving, just the AutoSave. Thus, I put,
Code: Select all
databaseManager.revertEditedRecords();

into 'onAutoSaveFailed'.

Now whenever there's an error, the record foundset now gets reverted back. Just like I wanted, thank you!

This also seemed to fix another issue I was having where since before the failed record didn't leave the foundset, the failed record would break the NG grid (it would only show the failed record on the grid).


I'll post again if anymore issues arise.
john1598360627
 
Posts: 169
Joined: Tue Aug 25, 2020 3:03 pm


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 8 guests