January 29, 200224 yr 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
January 29, 200224 yr 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
January 29, 200224 yr Author 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
January 29, 200224 yr 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.
Create an account or sign in to comment