Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7707 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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.

Posted

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.

  • 6 months later...
Posted

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...

Posted

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

This topic is 7707 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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