Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Consecutive folios in multiuser environment
Message
De
05/03/2018 11:19:47
 
 
À
05/03/2018 09:38:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01658516
Message ID:
01658538
Vues:
56
>>Hi, I need help; I need to use consecutive folios in a native table of FoxPro (DBF) in multiuser environment. How do I make the folios not duplicate? Any function?
>
>Hi Francisso, the old function
SYS(2015)
can help you. This will generate a non duplicate string with 10 characters. In example:
>
>MESSAGEBOX(SYS(2015)+CHR(13)+SYS(2015)+CHR(13)+SYS(2015)+CHR(13)+SYS(2015)+CHR(13)+SYS(2015)+CHR(13)+"5 consecutive aleatory strings",0,"sys(2015)")
>***or maybe you want this complete 28 chars string: year+month+day+hour+minute+second string:
>MESSAGEBOX(SYS(2015)+STR(YEAR(DATE()),4)+PADL(MONTH(DATE()),2,'0')+PADL(DAY(DATE()),2,'0')+PADL(HOUR(DATETIME()),2,'0')+PADL(minute(DATETIME()),2,'0')+LEFT(TIME(),2)+SUBSTR(TIME(),4,2)+SUBSTR(TIME(),7,2),0,"28 chars string")
>
>Just adjust your primary key and this will help you. I'm sure you won't have a duplicate key using this.

SYS(2015) doesn't guarantee uniqueness across different machines. I've run into situations that seem to indicate the function may not be unique across different processes on same computer.

https://west-wind.com/wconnect/weblog/ShowEntry.blog?id=926
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform