Gismo12 Posted November 5, 2018 Posted November 5, 2018 (edited) Hi, How will I approach to delete all records in a table where the container is empty. I tried a few scripts but ran into problems with most of them. Loop stayed in a loop I tried calculating container length and delete if length is zero, but the field does not calculate to a zero even if i set default to zero Edited November 5, 2018 by Gismo12
Steve Martino Posted November 5, 2018 Posted November 5, 2018 Could you explain in a little more detail what you are doing. I'm curious about a need to delete all records. Is this in Import, do something, delete? You could try this test. Name your container in the inspector "Container". IsEmpty(GetLayoutObjectAttribute ( "Container" ; "content")) Will return 1 if the container is empty. Although I'd really make back ups and test it. If the script is called from the wrong context, or hits an error, you may delete the wrong records. 1
comment Posted November 5, 2018 Posted November 5, 2018 4 hours ago, Gismo12 said: all records in a table where the container is empty. Actually, this problem is discussed in the help: https://fmhelp.filemaker.com/help/17/fmp/en/index.html#page/FMP_Help/finding-empty-non-empty-fields.html 54 minutes ago, Steve Martino said: IsEmpty(GetLayoutObjectAttribute ( "Container" ; "content")) Why go to through the layout, instead of directly to the horse's mouth: IsEmpty ( YourTable::Containerfield ) ? 1
Steve Martino Posted November 5, 2018 Posted November 5, 2018 1 hour ago, comment said: Why go to through the layout, instead of directly to the horse's mouth: IsEmpty ( YourTable::Containerfield ) ? True... 1
Gismo12 Posted November 8, 2018 Author Posted November 8, 2018 Thank you, but it does not seem to work. I have 152 records, i have a picture in one of the records, when I run the IsEmpty scripts, all 152 records are deleted. I tried below script but stays in loop. Here is my script:
comment Posted November 8, 2018 Posted November 8, 2018 Your script looks nothing like what was suggested.
Gismo12 Posted November 12, 2018 Author Posted November 12, 2018 I have tried the code as suggested, but as I said, It remains in the loop and nothing else happens. It is not deleting the records.
comment Posted November 12, 2018 Posted November 12, 2018 You have to be more meticulous with your coding. You have: Go to Record/Request/Page [ First ] inside the loop, where the example script has: Go to Record/Request/Page [ Next ; Exit after last: On ] so of course the loop never exits. Also, you are omitting the empty records, not deleting them. If you want to delete them, then - after the loop has terminated - switch to Show Omitted Only[] and do Delete All Records[]. Or delete them in the first place while still inside the loop. What you have now will delete one record - and that record is not empty (or it would have been omitted). 1
Gismo12 Posted November 13, 2018 Author Posted November 13, 2018 20 hours ago, comment said: You have to be more meticulous with your coding. You have: Go to Record/Request/Page [ First ] inside the loop, where the example script has: Go to Record/Request/Page [ Next ; Exit after last: On ] so of course the loop never exits. Also, you are omitting the empty records, not deleting them. If you want to delete them, then - after the loop has terminated - switch to Show Omitted Only[] and do Delete All Records[]. Or delete them in the first place while still inside the loop. What you have now will delete one record - and that record is not empty (or it would have been omitted). I have made the changes as suggested, it still remains in the loop.
comment Posted November 13, 2018 Posted November 13, 2018 I am sorry to say this, but this is getting ridiculous. You have no action specified for when the If[] condition returns true (it should be Omit Record). I said before that you need to pay more attention to detail. You have a perfect example given to you in the help, yet you can't follow it. I will not continue playing this game.
Recommended Posts
This topic is 2537 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