logo

New Response

« Return to the main article

You are replying to:

    • avatar
    • laurens
    • Posted on Fri 12 Mar 2004

    Shortening the url with @unique has above mentionede disadvantages. Problems people have with them are described in the R4 & 5 forum on Notes.net. But building further on your thoughts, creating one's own unique number may be more reliable.

    This formula may decrease the change of assigning one "unique" number to more than one document. Add a computed when composed field called UNID to the form with the following formula:

    all_chars := "A":"B":"C":"D":"E":"F":"G":"H":"I":"J":"K":"L":"M":"N":"O":"P":"Q":"R":"S":"T": "U":"V":"W":"X":"Y":"Z":"1":"2":"3":"4":"5":"6":"7":"8":"9":"0"; @For(n := 1;n <= 8; n := n+1; FIELD UNID := @If(n = 1;@Subset(@Subset(all_chars; @Round(35 * @Random) + 1); -1);UNID + @Subset(@Subset(all_chars; @Round(35 * @Random) + 1); -1))); UNID

    This formula creates 2.821.109.907.456 (unique) numbers. Depending on the expected number of documents in your database and the risk you want to take, you can in or decrease the number "8" in the formula to get a longer or shorter alphanumeric string.

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: