z178 Posted September 28, 2007 Posted September 28, 2007 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
z178 Posted September 28, 2007 Author Posted September 28, 2007 Got it PaddedText() function @ briandunning.com
Stuart Taylor Posted September 28, 2007 Posted September 28, 2007 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
comment Posted September 28, 2007 Posted September 28, 2007 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.
Recommended Posts
This topic is 6264 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 accountSign in
Already have an account? Sign in here.
Sign In Now