K1200 Posted July 17, 2007 Posted July 17, 2007 I have what would be classified as a "text serial number" that I need to increment by 1 upon certain user actions. The field needs to display with leading zeroes. For example: "0001002" would increment to "0001003". Can this be done without using a custom "pad text" function?
Raybaudi Posted July 17, 2007 Posted July 17, 2007 Hi any text field with autoenter option can do what you are after; simply start with "next value" = 0001001
stanley Posted July 17, 2007 Posted July 17, 2007 K1200: The trick is to make it a Text field, not a Number field. This will keep the leading zeros in place. -Stanley
K1200 Posted July 17, 2007 Author Posted July 17, 2007 Thanks for the response. These fields are not actual serial numbers, so I can't use the normal auto-increment method that FileMaker provides in the field definition. The numbers need to be incremented after the record is created (in response to user actions), so what I'm needing is a "text math" method that can accommodate the leading zeros. Stanley: the field is already text. How can it be incremented?
Ender Posted July 17, 2007 Posted July 17, 2007 See if this works: right("0000000" & getasnumber(field) + 1; 7)
K1200 Posted July 17, 2007 Author Posted July 17, 2007 Amazingly (to me), it DOES work! -- but I can't exactly see how it does. It seems it would simply concatenate the "000000" on the front of the incremented result, but somehow it merges. I know I'm overlooking something in trying to understand this, but what? UPDATE: OK, I see it. It does merge, but then eliminates the "overflow". (This has just been one of THOSE days.) Thanks.
K1200 Posted July 17, 2007 Author Posted July 17, 2007 The perfect choice. An aside: my search of the Calculation Forum this morning for "increment" didn't show any result that I could recognize as a solution. Now (after the fact)searching FileMaker's Help turns up nine topics; SerialIncrement is number six. Note to self: "must remember to try multiple resources when stumped". Consolation: "maybe someone will see these posts and learn from them". Thanks, comment.
Recommended Posts
This topic is 6399 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