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

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

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

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.

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 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.