Source language: Translate to:

dbPro command to execute a script BEFORE a record change?

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

dbPro command to execute a script BEFORE a record change?

Postby Enigman » Mon Sep 15, 2014 11:03 pm

Is there a dbPro command that will execute a script BEFORE a record change is made. I know the Table Open command allows specifying a script to execute AFTER changing the active record, but I need one before the navigation takes place. I know that this can be done by adding commands to any navigation buttons that precede the dbpNext or other navigation commands, but I need to be able to trigger a "pre-script" from the grid display. I cannot add commands to the grid display clicks so I think I need a dbPro command.

I need the script to check that certain things have been done before leaving a record. By the time an "OnRecordChange" script fires, the displayed data has changed and it is too late. In certain circumstances, using the LostFocus action works, but then that creates other problems.

Any ideas?

Thanks.
User avatar
Enigman
 
Posts: 314
Joined: Tue Apr 12, 2005 3:57 pm
Location: Foothill Ranch, CA

Re: dbPro command to execute a script BEFORE a record change

Postby Neosoft Support » Tue Sep 16, 2014 10:17 am

I'm sorry, there is no way to trigger a script before the current record changes.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5605
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: dbPro command to execute a script BEFORE a record change

Postby Enigman » Tue Sep 16, 2014 10:37 am

Neosoft Support wrote:I'm sorry, there is no way to trigger a script before the current record changes.

Bummer. :( That's what I was afraid of. I had to do a kludgie (sp?) workaround where I enable a semi-transparent object covering the grid until I can execute the script. That way navigation from the grid is disabled until the script finishes and turns off the cover. It lacks a certain elegance, but it works.
User avatar
Enigman
 
Posts: 314
Joined: Tue Apr 12, 2005 3:57 pm
Location: Foothill Ranch, CA

Re: dbPro command to execute a script BEFORE a record change

Postby dpayer » Tue Sep 16, 2014 12:37 pm

Enigman wrote:I need the script to check that certain things have been done before leaving a record. By the time an "OnRecordChange" script fires, the displayed data has changed and it is too late. In certain circumstances, using the LostFocus action works, but then that creates other problems.

Any ideas?

Thanks.


Couldn't you create a custom form that would get the content of the record and do the necessary checks before allowing editing and then have a submit button that would process the data back into the database?

Use the option to run a subroutine on a double click of a record.
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1384
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: dbPro command to execute a script BEFORE a record change

Postby Enigman » Tue Sep 16, 2014 1:03 pm

Couldn't you create a custom form that would get the content of the record and do the necessary checks before allowing editing and then have a submit button that would process the data back into the database?

Uhhhhhhh ... no ... not applicable.

What I am doing is making an "automatic save" capability. Human clicks would not be an option in that case. When the user makes changes to a displayed record, the Save button is highlighted reminding them to save their work. However, if they neglect to save and try to navigate away from the edited record, then I need to trap that situation and automatically save the edits before the record is replaced by another record. I had that all ironed out the usual way, by having every possible button that changes records first see if the record needs to be saved and do the save if necessary. BUT, the grid object has no action traps, so I cannot check for a save requirement if the user uses the grid object to change the active record. Without any way to do what I described in the original post, then the workaround is to cover up the grid the instant any edit has been made to the record. That is not a problem because the grid is not where records are edited. A set of regular text boxes allow the edits. The grid is used to scan through records. As soon as the auto save completes, the grid is uncovered. It's not an elegant solution but it solves the problem. I would have prefered a "before navigation" script as described above.

I know that dbPro provides an auto-save parameter, but I cannot use that because the record must be encrypted before saving and the dbPro auto-save cannot do that.

Thanks.
User avatar
Enigman
 
Posts: 314
Joined: Tue Apr 12, 2005 3:57 pm
Location: Foothill Ranch, CA


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 1 guest