Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question about sys(2015)
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00456573
Message ID:
00458482
Views:
20
David,

I'v been using SYS(2015) to generate Id's for many years in both single and multy user apps, and I'v never had
an incident of duplicate Id's.

I wrote a small function to return a unique Id. It allows me to pass in an optional first character. And it strips off
the leading underscore. The benenfit of using a function is that should you change how you generate your Id's,
you only need to modify the function. This function only returns the right 8 characters.



FUNCTION GetUniqueId
LPARAMETERS cCharacter

  cRetVal = RIGHT(SYS(2018), IIF(PCOUNT()=1), 7, 8)

  IF PCOUNT() = 1
    cRetVal = cCharacter + cRetVal
  ENDIF

RETURN cRetVal



Hope this helps
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform