Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Delete last empty record in a list

Featured Replies

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.

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 by comment

  • Author

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.

image.png.fb01d63198f937d3fdeee75dbbe07b99.png

image.thumb.png.c334c47a53b92d154870c344098823db.png

I am not sure I understand what you're showing us. What exactly does the "Add" button do?

  • Author

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.

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 by comment

  • Author

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

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.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.