Greg58 Posted April 16, 2019 Posted April 16, 2019 I have a list with three fields of data. The first is 'task', and the next two have autofills for 'not urgent' and 'incomplete. If the task field is empty I would like the record to automatically delete. I have messed about with 'IF (isempty)' but having no success. Any assistance would be appreciated please.
comment Posted April 16, 2019 Posted April 16, 2019 (edited) You need to run a script in order to delete a record. You can attach an OnObjectSave script trigger to the Task field - or, perhaps preferably, attach an OnRecordCommit script trigger to the layout - to run a script that will check if the Task field is empty and delete the record if the test is true. A semantic note: the term "list" is used in Filemaker for text containing a list of return-separated values. I think you meant a found set here. And if you want to limit the deletion to the last empty record, we'll need a clarification of what exactly "last" means. Edited April 16, 2019 by comment
Greg58 Posted April 16, 2019 Author Posted April 16, 2019 Thanks for that advice. Just to clarify, the below image is where I add a task. My problem is that if I hit the menu button from this page without filling out a task (perhaps I decided not to do it), I get a blank entry as in the next picture. I would like to have that blank task delete if there is noting in it. Thanks for any help you can give.
comment Posted April 17, 2019 Posted April 17, 2019 I am not sure I understand what you're showing us. What exactly does the "Add" button do?
Greg58 Posted April 17, 2019 Author Posted April 17, 2019 The add button is to add the task to the db. But if I decide not to add it and press the menu button it add the blank task.
comment Posted April 17, 2019 Posted April 17, 2019 (edited) 3 hours ago, Greg58 said: The add button is to add the task to the db. I am afraid that doesn't tell me much. When I ask what exactly does a button do, the expected answer is "it runs a script that does [a list of steps]". The only thing I understand from your description is that the task is added to your table even if you do not press the Add button. So I am guessing that a new record is already created before you start filling those fields shown in your screen shot. If this is so, and you want to prevent the Task field being empty, you should validate the Task field as not empty. That will prevent the new record from being committed - and the only remaining question is how to make user experience more pleasant by not exposing them to validation error messages. Edited April 17, 2019 by comment
Greg58 Posted April 18, 2019 Author Posted April 18, 2019 Thanks for that. I did the validate as 'not empty' and that does fix the problem, but as you say not a great user experience. I will work on that. Thanks again. Greg
comment Posted April 18, 2019 Posted April 18, 2019 2 hours ago, Greg58 said: as you say not a great user experience. There are two possible ways to approach this: 1. Prevent users from committing the record in any other way except by clicking the "Add" button; then you can run a script that will check if the field is empty and either commit or refuse, giving a more user-friendly error message; 2. Script the creation of new records, using either variables in a custom dialog or global fields for user entry.
Recommended Posts
This topic is 2319 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