Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unique Ids
Message
 
À
01/04/1997 13:44:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00026435
Message ID:
00026627
Vues:
26
>Does anyone have a technique on creating unique ids for tables (as primary keys) besides the VFP sample that uses NewId()??
>
>Our problem is our users want to connect to the data (via drive mapping), sync their data, disconnect, modify information, reconnect and re-sync (sending their updates ..and receiving anything new that has changed since they were off-line).
>
>Could off-line views be an option(???).
>Does anyone have any pros/cons of off-line views??
>or other solutions/suggestions.
>TIA


This is the routine I use for generating a unique id for a record. Maybe it will help.

Good Luck
Harvey

******************************************************
* Returns a unique 7 character string based on the
* system date and time. Should not duplicate for 100 years
******************************************************
PROCEDURE AUNIQUE
LOCAL WORKNUM, WORKNUM1, RESULT, REMAINDER, X

&& generate a unique number based on date and time
WORKNUM1 = VAL(STRTRAN(DTOC(DATE()),"/","")+SYS(2))
RESULT = ""
FOR X = 1 TO 7
REMAINDER = MOD(WORKNUM1,36)
IF REMAINDER < 10
RESULT = RESULT + ALLTRIM(STR(REMAINDER))
ELSE
RESULT = RESULT + CHR(REMAINDER + 55)
ENDIF
WORKNUM = INT(WORKNUM1/36)
WORKNUM1 = WORKNUM
NEXT X
RETURN RESULT
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform