Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How would I create a unique 10 digit numeric id?
Message
From
08/01/2003 16:24:52
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00739539
Message ID:
00739564
Views:
9
>I was thinking about combining 2 sys(3) values to create a key but I have seen negative and non unique values from sys(3).

SYS(2015) gives you unique IDs, no matter how fast you issue it.

If you prefer the kind of value generated by sys(3), you can just use:
*------------------------------------
* Function...: UniqueID
* Author.....: MARTIN
* Date.......: 18/02/1998
* Notes......: Generates a unique name. As SYS(3) can generate the same value
*            : when issues in the same millisecond, this function throws the first
*            : one and returns the second.
* Parameters.: None
* Returns....: A unique ID name
* See Also...: 
* 
local lcRetVal
lcRetVal = sys(3)			&& Takes the first value

do while lcRetVal = sys(3)		&& Waits for a different one
enddo

lcRetVal = sys(3)			&& Returns the safe one (or the next!)

return lcRetVal
*-------------------------------* Fin 
Hope this helps,
Previous
Reply
Map
View

Click here to load this message in the networking platform