Autor Thema: Fortlaufende Nr. @unique  (Gelesen 1057 mal)

Offline MrMagoo

  • Senior Mitglied
  • ****
  • Beiträge: 359
  • Geschlecht: Männlich
  • AAAhhh
Fortlaufende Nr. @unique
« am: 04.08.04 - 10:59:20 »
Hallo zusammen,

also ich brauche eine Art fortlaufende Nr. in Notes Dokumenten. Dabei bin ich auch @unique gestossen.

Aus der Hilfe: Wenn kein Parameter angegeben, wird ein nach dem Zufallsverfahren eindeutige Textwert zurückgegeben.

Kann mir jemand sagen wie dieser Textwert zustande kommt.
ABUR-63JBQQ also die ersten 3-4 Zeichen spiegeln den Usernamen wieder, soweit bin ich, aber dann?

Danke
« Letzte Änderung: 04.08.04 - 11:00:22 von MrMagoo »

Glombi

  • Gast
Re:Fortlaufende Nr. @unique
« Antwort #1 am: 04.08.04 - 11:03:23 »
Aus der KBASE:

How Does @Unique Generate its Unique String?

Problem:

How unique is the string returned by @Unique ?    Are there circumstances under which a non-unique string may be returned?

Solution:

The string that @Unique returns when invoked with no arguments consists of two parts: the first part (the prefix) is generated using the common name of the Notes ID in use.  The second part (the suffix) is generated from the current time.  The two parts are separated using a hyphen ("-") .  For example,

<prefix>-<suffix>

For a given Notes ID,  the prefix will be constant.  The suffix will vary depending on both the system time and the frequency of invocation.

The prefix is (usually) a four-letter string, consisting of uppercase alphabetic characters (A-Z); this gives an absolute maximum of 26^4 unique prefixes, or ~450,000 strings.  In practice, however, the number of prefixes generated will be reduced since people's names do not contain a uniform distribution of letters.

The prefix is selected using the following algorithm to select the four-character prefix, stopping when four characters are selected:

-   Select the alphabetic uppercase characters in the common name.
-   If three characters have been selected, use the last character in the common name; if not, select the character after the last selected.
-   Translate the four characters to uppercase.

The suffix is a six-letter string, consisting of digits and uppercase characters from the set [2-9A-HJ-NP-Z]; this gives an absolute maximum of 32^6 unique suffixes, or ~1000,000,000 unique strings.  In practice the number of unique strings is reduced as the value of the strings is not random.  The first three characters are based on the number of days since a fixed date, the last three characters, is based on the number of seconds since midnight.  

The first three letters of the suffix are therefore identical for all sequences generated on the same day, and different for any sequences generated on different days.

The last three characters of the suffix are generated based on the number of seconds since midnight.  Within a Notes session a check is made to ensure that the last three digits are not based on the same time (e.g. using the F9 key to refresh will generate sequential (base 32) numbers).  If the Notes client is restarted, however, the sequence is generated from the time directly without regard to any previously generated sequence.  This means that the sequences may 'restart' earlier than those generated using the F9 key.  For example, if F9 is pressed 30 times, the sequence number corresponds (roughly) to 90 seconds in the future.  If Notes is restarted, and a sequence generated less than 90 seconds later a sequence number may be reused.

In practice for non-automated use of @Unique the sequence should be unique if:

1.   The prefix differs
2.   The sequence numbers were generated on different days
3.   The sequence numbers were generated using a time for which the effective clock time differed

This information is provided to assist in assessing if the @Unique function is appropriate for a given application.  It is possible that the algorithm used may differ between releases, and may be changed in a future release.  Applications should not depend on the behavior of @Unique documented in this document other than that the value returned should under most circumstances be unique.

Andreas

Offline MrMagoo

  • Senior Mitglied
  • ****
  • Beiträge: 359
  • Geschlecht: Männlich
  • AAAhhh
Re:Fortlaufende Nr. @unique
« Antwort #2 am: 04.08.04 - 11:54:39 »
Danke :)

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz