Totes Posted February 18, 2008 Posted February 18, 2008 (edited) Hi, Does someone have an example of a looping script they can point me to so I can try to learn, I did a search but could not find anything close that will delete records. This weekend I was trying to create a script that will delete all records that are more than a year old, and all I can manage to do is delete one record and then I have to Ctl Alt Delete so I can kill FM because I get stuck in an endless loop. James Edited February 18, 2008 by Guest
The Big Bear Posted February 18, 2008 Posted February 18, 2008 Ranger It would be easier to do a find for all the records a year older and then delete them as a found set. If you have a field to search on try something like this. enter find mode set field (input field; search field) preform find show custom dialog "is these the records you want to delete?" If (last message choice = 1 Delete all records show all records else show all records goto wherever Hope this helps Lionel
comment Posted February 18, 2008 Posted February 18, 2008 Without seeing your script, I can only guess that it either doesn't move forward in one of its branches, and/or you haven't checked the 'Exit after last' option when moving to the next record. Speaking generally, any time you go into a loop, your first thought should be how to exit it.
Totes Posted February 18, 2008 Author Posted February 18, 2008 Thanks everyone for the info...it seems that my foulup was in the exit. This was my first attempt at a loop and I was just poking buttons hoping I could get the script set correctly, but my exit was the problem. Now another question...is it it better do do a multi-delete via a scripted loop or by a find like the Bear showed? Thanks for the assist. James
mr_vodka Posted February 18, 2008 Posted February 18, 2008 In this case, it would make more sense to just find the records and then delete. No need to waste processing time with a loop when it could be done with a few script steps. With a loop each record has to be tested with your loop criteria. With a find it will do the search one time.
Fitch Posted February 18, 2008 Posted February 18, 2008 To loop or not to loop... it depends on the problem you're trying to solve, James. If it's exactly as stated ("delete all records that are more than a year old"), Bear's solution would be more efficient.
Totes Posted February 18, 2008 Author Posted February 18, 2008 Thanks, I try that one as well, never can have too many options. James
Recommended Posts
This topic is 6124 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