Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hashing alphanumeric string...
Message
From
17/09/2003 10:14:31
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00829843
Message ID:
00829860
Views:
20
>>
>>Perhaps you could use a serial number as a PK, and store the FldRoom and FldFloor fields separately?
>
>Yes! it can work but in this case the data will be transfer from on web service to another. So I need a PK that I can recreate from the two fields.

In that case, you may need to use a character PK.

Or, you could convert the string "001BT007" as follows. Treat each letter as two digits. That is, from right to left: multiply 7 by 1, 0 by 10, 0 by 100, "T" (perhaps its ASCII value) by 1000, "B" by 100,000, 1 by 1e6, 0 by 1e7, 0 by 1e8. Note that for a 4-byte integer, your highest integer value is ca. 2e9.

Also, I am assuming that all codes use the same format (e.g., 3 digits, 2 letters, 3 digits).

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform