Jump to content

Set Field to next consecutive number


 Share

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

Recommended Posts

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

Link to comment
Share on other sites

thanks guys smile.gif" border="0 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 smile.gif" border="0

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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