Simplicty and flexibility!


Function::Internal

UniqueID
UniqueID()
retval := UniqueID() .


It has been a tradition in DataEase to use Sequence From to create a unique Record Identifier. This is not a good idea as Sequence From will not be allocated to the record until the record is saved, and it can also cause problems if the sequencer loose track of itself. 

UniquedID is created to insure that a developer can uniquely name and identify a record.

Parameters


None

Returns/Result


String(16): Non Sequence Unique ID. Good spread to increase search speed with index.

Examples


Reference

One of the most popular and frustrating functions or should we rather say functionalities in DataEase is "Sequence from".

Basically this is a "guaranteed" sequence number, and it is great when you need records to be in sequence and have a unique number. Problem is that if to people register data in the same table at the same time, the Sequence number you get when you start typing into your record, might not be the one the record ending up having when it is saved.

The Sequence number you get when you start registering is the highest available at that time, and the same goes when you hit save, but in the meantime someone else might have saved a record and the next available is hence one higher, or many numbers higher. The uniqueness and the sequence is preserved, but if you have use the Sequence number to derive, link etc..you are in the sh....t.

The truth is that in most cases where we use Sequence From, we are simply looking for a unique key and not a sequence, so wouldn't it be better if we had a true Unique Key generator?

In PRISM 9 (The next prism version after this) all records will have an automatic unique ID, but for now we must do it manually.

Enters: UniqueID() which returns a 16 character long guaranteed unique Key.

The result will look like this: B40EHNT8Q92445WX or 953V8Z0IOV9NB5JZ etc.

Make sure your Unique field is 16 characters long and text, or you might find that it is not unique after all ;-)

See Also


On the forum about UniqueID

On the blog about UniqueID

New Function in 8 - UniqueID() - Returns a "Random" Unique ID as Key for a Record (Ver 8.0.0.1139)

One of the most popular and frustrating functions or should we rather say functionalities in DataEase is "Sequence from". Basically this is a "guaranteed" sequence number, and it is great when you need records to be in sequence and have a unique number....

Product: Dataease [{8}]FIVE. Written by DataEase 01/10/12 at 07:42:05

Re:New Function in 8 - UniqueID() - Returns a "Random" Unique ID as Key for a Record (Ver 8.0.0.1139)

Am I right in stating that this function replaces the Set/Get Uneek CDF? And is it right to assume that this unique id can be used to retreive records etc? thanks...

Product: Dataease [{8}]FIVE. Written by Josef Vella 11/10/12 at 12:39:01

Re:Re:New Function in 8 - UniqueID() - Returns a "Random" Unique ID as Key for a Record (Ver 8.0.0.1139)

Hi! This is simply a function that genearte a "guaranteed" unique ID that one can use as one please, but the short answer to the question is... Yes! In PRISM 9, and ID like this will be an integral part of the database design, but till then you will ne...

Product: Dataease [{8}]FIVE. Written by DataEase 11/10/12 at 12:49:33


dg3_HelpView