KLA Posted January 29, 2002 Posted January 29, 2002 I'm trying to write a script that will change the number in a field to the next consecutive number. I would like it do do it to a found set of records. So, i created a script with a loop. It works when the number is "1" - it will change to "2". However the next time i run the script it stays at "2" - it doesnt' change to "3". It also skips the last record because i couldn't figure out how to make it do the last record and then stop. Anyway, here's what I have: Loop Set Field ["A", "Count(A) +1"] Go to Record/Request (Next) Exit Loop If [status(CurrentFoundCount)=Status(CurrentRecordNumber) End Loop
tlsparker Posted January 29, 2002 Posted January 29, 2002 Try this script instead: Create a global field called "gCounter" Set Field ["gCounter", "0"] Loop Set Field ["gCounter", "gCounter+1"] Set Field ["A", "gCounter"] Go to Record/Request (Next, Exit After Last) End Loop
KLA Posted January 29, 2002 Author Posted January 29, 2002 thanks guys I used the A+1 and checked the Exit after last. Didn't have to do the counter on this - don't think i need to but will keep in mind for future if this other doesn't work out for some reason. Thanks
Vaughan Posted January 29, 2002 Posted January 29, 2002 Instead of the loop and Set Field [], you could replace the whole lot with a simgle Replace [] step... Replace [by calculation, "A = A+1"] I've written the step in pseudo English to give you the idea. Just make sure that the appropriate set of records is found before the Replace[] step is peformed. Here's an idea: do both scripts and time which is faster. Let us know the result.
Recommended Posts
This topic is 8338 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