Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Question about sys(2015)
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00456573
Message ID:
00458482
Vues:
21
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform