>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement