Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hashing alphanumeric string...
Message
De
17/09/2003 10:14:31
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00829843
Message ID:
00829860
Vues:
21
>>
>>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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform