Jump to content

looping script problem


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

Recommended Posts

I am trying to write a script that changes one value to another, but only in a condition. here is the script:

Go to Record/Request/Page [First]

Loop

If ["state="california" "]

Set Field ["state" , "state="CA" "]

Go to Record/Request/Page [Next]

End If

Exit Loop If ["Status(CurrentRecordNumber) = Status(CurrentFoundCount)"]

End Loop

This seems to go infinitely and when I cancel, all the values are zero. Also, How do I set a variable? As this script shows, I need to change the parameters each time I want it to find a state, or write a script for each state. I would ultimately want to write a script with each state set as a variable, and loop through the entire database.

Is this the best way?

Any help with this problem would fantastic.

Rich

Link to comment
Share on other sites

If you want to use variables, why not try a slightly different approach.

Create two global fields to act as set find variable fields. I'll call them gstatelongname and gstateabrev. Once you enter the state you are looking for in gstatelongname and enter the abreviation to be used in gstateabrev you could perform a script such as:

Enter Find Mode

set field State gstatelongname

Perform Find

Replace [state, Replace date:Calculation:, gstateabrev]

no dialog

Link to comment
Share on other sites

The problem with your script is that the "Go to Record/Request/Page" step is inside your If..End If. As soon as you reach a record without state = california, you will be stuck on this record forever. Move this statement below the End If. -bd

Link to comment
Share on other sites

This topic is 7786 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
 Share

×
×
  • Create New...

Important Information

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