March 25, 200322 yr I need a exit script that will clear the the checkboxes in a field for all records .... any ideas
March 25, 200322 yr I know it's dangerous, but Replace script function will do it for you : Got o Layout (where the field is) Goto field (select your field) Replace (your field, ""). If your need is for an exit script, there are some examples here on the forum.
March 25, 200322 yr Replace is slightly easier to implement, but you do have to be careful to be on a certain layout, and that the field you're changing is on that layout. The alternative method, that can be used whether or not you or the field are on a layout, is with a loop: Show all records Go to record [first] Loop ..Set Field [yourField, ""] ..go to record [next, exit after last] End Loop Note that both replace and looping can be problematic in a multi-user system: if someone else is using the record, that record will be locked and the script will fail. The usual workaround is to turn on error trapping and create a log file, then go back and deal with the errors later. If your system is single-user, you don't have to worry about it.
March 25, 200322 yr One minor caveat: If the field is a Number Date or Time field, you need to SetField[yourField, TextToNum("")] -- or TextToDate or TextToTime, as the case may be.
October 21, 200322 yr Another caveat. If you have field validation turned on for any fields in the db and some records fail it, it will cause the loop to hang when it tries to go to the next record...
October 21, 200322 yr This is why I prefer to validate by script whenever possible. Field validation can be a royal pain in the ass and screw a script up when you least expect it. If there is no choice, then I test for failed validation when Go(ing) to Field[ ] with: Loop Go to Field [ ] Exit Loop If [not Status(CurrentError)] Show Message ["Your data is jacked! Please fix it, then press Enter."] Pause/Resume Script [ ] End Loop
Create an account or sign in to comment