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

How to clear all fields with a script


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

Recommended Posts

Posted

Hi All,

What I'm trying to accomplish is a script, that when run will clear certain fields in that record. I have cost, quantity and total fields that I want to be able to have the user clear, without deleting the contens of each field individually. I tried this:

Loop

Goto field (field1)

Clear

Goto next field

Clear

If getfield (total cost)

End If

End Loop

Beep

But, of course, it doesn't work.

Any help would be greatly appreciated.

Thanks in advance,

Don

Dmacman

[ September 07, 2001: Message edited by: Dmacman ]

Posted

You can clear any field except a date field with the following:

SetField(quantity,"")

On date fields use the following: SetField(MyDate,TextToDate(""))

Posted

I don’t know if this will help you…. But one of the most effective ways of deleting lots of fields in one record is as follows:

Lets say you have 20 fields in a record and you want 15 of them deleted.

Create a self-relationship based on an individual ID for each record.

Set the 5 fields you don’t want to delete to lookups based on the above relationship.

Create a script that:

Omits the record you want to edit

Finds omitted – i.e. only the record you want to edit

Creates a new record

Sets the ID field in the new record to the ID of the original record

(Performs the lookups on the 5 fields)

Then deletes the original record

Believe me, this idea sounds crazy, but in some situations it’s a lot better than using loops etc. to set fields to 0 values. Anyone who doesn’t believe this should give it a go:

Set up a record with 20 or 30 fields where most of them should be set to 0 values. Then use the set field command to set from 30 25 fields to “” or 0. After this, try the method above – you’ll see that it’s about 50 times faster.

Rigsby

This topic is 8477 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.