Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UDF to return a unique value
Message
From
16/04/2001 16:06:29
 
 
To
16/04/2001 15:29:44
Mike Mattos
Nationwide Computers
Mississauga, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00495811
Message ID:
00495922
Views:
13
>can you safely use a key here ?
>
>I am concerned that the table may change over the years, and keys get re-used!


I don't worry about it. With integers you can get 4 billion unique values if you use negative numbers. The storage space is minimal too, only 4 bytes.

>
>The keys may have to control both current and archival data, but the system may not have the archive data available all the time! ( either a value may get two keys, or one key may refer to two values , unless you keep a table with all keys that have been created and their value, a serious problem if you get audited 5 years down the road! )

Yes, you keep track of the last used number. That means one table that handles this for you.

>
>
>I suspect that there is no ultimately no safe way to control a big field with a small one!
>
>However, if you use a simple hex look up system, you get far more mileage from your 6 byte field!
>( create a look up table that stores all used strings to a new hex value, , thus using all 255 values instead of just the commonly used 10 numeric + 26 or 52 alpha, thus the field can hold about 30,000,000,000,000 ( 256 ^ 6) values, which should be enough! )

You could use a hex system. There are lots of options other than mine. However, many people have told me they use my code and have never had a problem. Neither have I.

>
>The math isn't confirmed, but I hope you get the ideas & concerns
>
>Mike
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform