Valdrin Posted December 1, 2003 Posted December 1, 2003 Hi All, The problem: For various reasons, users are occasionally hitting the new record button in a database when there is already a new blank record. This leaves blank records scattered through out the database, which is causing some problems. The solution: instead of having the new record button linked to "New Record" use a script that will check for a blank record before creating a new one. This is what I've come up with so far: Go to Layout["Main"] Sort [Restore, No dialog] Go to Record/Request/Page [Last] If [isEmpty(FirstName & LastName) Exit Script End If New Record/request Is this the best way to handle the problem, or is there a better way? Thank in advance.
Fitch Posted December 1, 2003 Posted December 1, 2003 That script will only work reliably if you Show All Records first. But that could get slow and annoying if you have a lot of records. A typical way to handle this is to create a layout with global fields for at least the initial data entry. Include a Save and a Cancel button. If Cancel is clicked, no record is created. When Save is clicked, you run a script that sets the global fields' data into corresponding fields in a new record.
Valdrin Posted December 1, 2003 Author Posted December 1, 2003 Fitch said: That script will only work reliably if you Show All Records first. But that could get slow and annoying if you have a lot of records. A typical way to handle this is to create a layout with global fields for at least the initial data entry. Include a Save and a Cancel button. If Cancel is clicked, no record is created. When Save is clicked, you run a script that sets the global fields' data into corresponding fields in a new record. There will only be 800 to 1200 records, so the speed should not be a problem. Using a layout with global fields for the data entry sounds like it might be a more elegant solution, but I'm not quite sure how to implement it...
John Caballero Posted December 2, 2003 Posted December 2, 2003 Basically you create global fields for all the "real" fields which your users would normally input directly into. You'd mimic your regular layout, but replace the existing fields with their global counterparts. You'd have two buttons: Save and Cancel. Your users would input data into the global fields. When they clicked the Save button, then you'd create a new record and use a series of Set Field script steps to set the values from the global fields into your "real" fields. You'd probably want to clear out the globals (again, using a series of Set Field script steps) after the real fields are populated. Clicking the Cancel button would just clear out the globals - no new record would be created.
Recommended Posts
This topic is 7665 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now