Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

UniqueNum

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 4.2  (38 votes)
  Discuss this Custom Function

Joshua Beckett & Anton Anderson, The Wine Curators
http://www.personalwinecurator.com

Creates a unique, never to appear again number

Sample Input:
UniqueNum
Sample Output:
2010142134803


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

Creates a unique 13 digit number based on year, day of year and time; result will always be 13 digits
EXAMPLE: may 23, 2010, 1:48 PM (and 3 seconds) = 2010142134803
Use to generate unique numbers (for IDs, identifiers, etc) within a solution without the need ever to check for duplicates, because there can only and ever be one instance of the year, day of year and exact time, including seconds.
[**NOTE: Intended for a single-user environment.
Filter ( Get ( CurrentTimestamp ) ; "0123456789" ) gives you almost the same result (e.g. 624201010157) but will not sort as well as UniqueNum (2010175130157); also, UniqueNum will always result in the exact same number of digits, which, for some purposes, is critical]

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it

Discuss:

5 most recent comments | Show all 11 comments

thanks for these notes. i have now included a note indicating this is intended for a single-user environment.

Joshua Beckett, Los Angeles
June 24, 2010 3:12pm

@ Darren: Great suggestion!
@ Bart/Brian: We wrote the function for a run-time app, so it was only expecting a single-user environment, where sorting was a key requirement. While not at the level of a UUID, this function did the trick.

Anton Anderson, Altadena, CA
June 24, 2010 4:12pm

Computer clocks are *not* reliable. They require routine updates to maintain accurate time. If your computer syncs via a time server you may not even realize that your time was automatically adjusted backwards one minute. Records created individually aren't too likely to obtain a duplicate key, but records created via import increase the probability.

When it comes to database integrity, why take the chance? I'd highly recommend that you use Ray Cologon's excellent Base36 uID custom function instead.

http://www.nightwing.com.au/FileMaker/demos9/demo910.html

Dave Graham
Bit Tailor, LLC

Dave Graham, San Diego, CA
June 25, 2010 12:32pm

I'd recommend you to use the uUID instead of this or of the Base36 uID. It can be packed into any file and is very fast in creation - and the probability that you encounter two identical numbers is veeeeery low :-)

http://www.briandunning.com/cf/969

Martin D. Brunner
Zürich

Martin D. Brunner, Zürich
July 01, 2010 2:31pm

Hello, all,

Mr. Brunner and Mr. Graham are right, for there are situations where FileMaker could generate from two up to 'n' records within a single second — it depends mostly on CPU speed and scripting. If you add FileMaker's own Record ID to your CF, then it should generate unique numbers. It's redundant, though: for one could use FM's record id preceded by several zeroes, such as Right ( "00000" & Get ( RecordID ) ; 5 ).
The notion of using date and time data for id-ing a record is quite old, and has to do with the possibility of retrieving such data through a calculation (ergo without the need of specific date and time fields).
I, for one, rely on Ray Cologon's Base 36 uID CF for generating unique IDs.
Check his website, especially the demo section — http://www.nightwing.com.au/FileMaker/demos.html — for he has unique and ingenious ideas and a deep knowledge of FM and CF.
Good luck.

Edward Souza, Victoria
August 15, 2010 12:03am

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 0 + 9 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. ProperAllWords ( text )
  (Thu, Dec 14, 5:19pm)
2. MatchExist ( SourceTable.Field ; DestTable.Field ; ReturnField )
  (Thu, Dec 14, 1:07pm)
3. BVR_Format ( bvr )
  (Wed, Dec 13, 5:32pm)
4. NumberToHexadecimal(NumberValue)
  (Fri, Dec 08, 8:54am)
5. Get_BaseTable
  (Thu, Dec 07, 4:27pm)
6. JSONCreateVarsFromKeys ( json ; namespace )
  (Wed, Dec 06, 8:21pm)
7. GetTableNzme ( field )
  (Tue, Dec 05, 9:16pm)
8. TimeFormatAsText ( theTime )
  (Mon, Nov 13, 1:59pm)

RSS Feed of Custom Functions