Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Replace Primary Key

Featured Replies

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

  • Author

Got it

PaddedText() function @ briandunning.com

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

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.

  • Author

Thanks

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.