Jump to content

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

Recommended Posts

Posted

I have a database that has primary keys starting from 1 and serially incrementing by 1.

Am trying to change it using Replace field contents

How do I do the calculation that the final PK looks like

DOC0001, DOC0002 (from 1,2...)

"DOC" & (0000+PK)

didnt help much

Posted

Just so you know ... you can enter "DOC0001" as the serial Number/Code in full and FileMaker will handle it correctly, no calculation needed.

This will also prevent the forthcoming issue you will have when you hit 10+

Your current calc will result in:

DOC0001

DOC00010

DOC000100

If you need the prefix to be dynamic you can use:

DOC & Choose ( Length ( PK ) ; "0000" ; "000" ; "00" ; "0" ) & PK

best

Stuart

Posted

you can enter "DOC0001" as the serial Number/Code in full and FileMaker will handle it correctly, no calculation needed.

Make sure the field type is Text, if you do that.

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