Jump to content

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

Recommended Posts

  • Newbies
Posted

Hello,

I have a text field that holds a code like so "03-0528-1". The field is a standard text field so that I can allow the dashes. How can I increment the last number so that it becomes "03-0528-2" using insert calculated result(script)?

Posted

There is no need for an insert calculated result. Just use Set Field [textfield, Substitute( LeftWords( Substitute( textfield, "-", " " ), 2 ) & " " & NumToText( RightWords( Substitute( textfield, "-", " " ), 1 ) + 1 ), " ", "-" )].

This will convert the hyphens to spaces so the groupings can more easily be extracted, add 1 to the number furthest to the right, change it back to text, and convert the spaces back into hyphens.

Will this work for you?

  • Newbies
Posted

thanks for the replies- this does not need to increment on every record, only on certain ones- so autoincrement wont suit my needs- i'll try the setfield option

thanks

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