Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Consecutive folios in multiuser environment
Message
From
05/03/2018 11:19:47
 
 
To
05/03/2018 09:38:53
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01658516
Message ID:
01658538
Views:
57
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform