Newbies montenegro Posted December 19, 2003 Newbies Posted December 19, 2003 Hello, I'd like to add a functionality to my file where with a click of a button that is on that file, FM will check if there is any empty records in that file and automatically delete them from a file. What is the best way to do it? I tried using basic scripts, but there is nothing there. Thanks
John Caballero Posted December 19, 2003 Posted December 19, 2003 Depends on what constitutes an empty record. Do all the fields need to be empty or just key ones? You could create a calculation field that looks like this: IsEmpty(field1) and IsEmpty(field2) and IsEmpty(field3)... If all the important fields are empty, the calculation will return a value of 1. You could then create a script that searches for all the records whose calculation field returns a 1 and deletes the found set. You'll probably want to check to see if the find returns any records. If it doesn't, you'll want to exit the script, otherwise you may delete records you want to keep.
Lee Smith Posted December 19, 2003 Posted December 19, 2003 Hi montenegro, IMHO, it would be better to deal with the cause instead of the effect. You can control the adding of blank records by taking some preventive steps in your design. I would do the find and deleting by hand. As you might suspect, this topic comes up quite frequently. A search of the Forums using Duplicate Records should produce several threads, including one that was active in the last day or so. HTH Lee
Lee Smith Posted December 19, 2003 Posted December 19, 2003 Hi John, With you on the board, it looks like I'll have to stop taking phone calls when answering posts.
John Caballero Posted December 19, 2003 Posted December 19, 2003 I second what Lee is suggesting. A good solution for making sure records aren't created inadvertently is to script the process. You'd have a button called New Record (or something like that). This would take you to a layout that was a duplicate of your regular layout but was populated with global fields that mirrored all the regular fields. It would be the global fields into which your user would enter data. On this global field layout, you'd have a Save and a Cancel button. Clicking the Save button would execute a New Record/Request script (you could even put in a "Are you sure" type of confirmation message before the new record is created if necessary) and then a series of Set Field script steps would set the contents of your regular fields with the contents of their global counterparts. You'd then clear the globals and return to the regular layout. The cancel button would just clear the globals and return to the regular layout. (Hint - since the last steps the Save script are the same as the Cancel script, you could just call the Cancel script where you would normally have to duplicate the script steps.)
John Caballero Posted December 19, 2003 Posted December 19, 2003 Are you on the phone with Arnold, making sure he doesn't screw up as Governor?
Recommended Posts
This topic is 7648 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