Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SYS(3) & VARIABLES
Message
From
13/07/2001 09:36:04
David Fluker
NGIT - Centers For Disease Control
Decatur, Georgia, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00528678
Message ID:
00530203
Views:
26
>>A word of caution -
>>Yes, sys(2015) always starts with a character, but SUBSTR(SYS(2015), 3, 10) does not. It will generate valid file names, but it can generate invalid eight character variable, field, or table aliases. If you want an eight character unique name use "_" + SUBSTR(SYS(2015), 4, 10) instead.
>
>
>One warning, sys(2015) returns a string in the following format:
>
>_dddpppppp where ddd represents the day and pppppp part of the day.
>So if you only use the "pppppp" part, the string is only unique for 24 hours because when you would issue the same command exactly 24 hours later, you could get the same string back.
>I've created routines to convert sys(2015) to datatime (and milliseconds) and back some time ago and you can find them in the download section (File ID = #1223)
>In there I've commented the way a sys(2015) is composed.
>
>hth,

Cool! I just downloaded your functions and documentation. So '_'+RIGHT(SYS(2015),7) gives me at least 36 days of unique 8 character names that start with a character. I can stretch it to a year by adding the month
CHR(64+(month(date()))) + RIGHT(SYS(2015),7)
or even two years by adding a little of the year
CHR(64+(month(date())+(12*(YEAR(date())%2)))) + RIGHT(SYS(2015),7)
I could probably stretch it more, but I while I don't need 8 character names anymore, I do need to get back to work ;-)

Thanks Frank!
David.
Previous
Reply
Map
View

Click here to load this message in the networking platform