Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Input Mask Question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00177692
Message ID:
00177701
Vues:
30
>... I am not storing the mask with the data (format = "!R" on the bin location text box class).
>
>I expected to be able to use TRANSFORM() to apply the mask to the data, but it doesn't work correctly with character data.
>
>a = "A-999"
>b = "Z123"
>?transform(b,a) ---> "Z-23"

You need a = "@R A-999" for this to work (old FoxPro @/GET PICTURE syntax). The parameters you pass to TRANSFORM() are separate from the input mask you put on the textbox object. i.e. the "!R" in textbox.InputMask doesn't affect the TRANSFORM() call.

>It appears that character "spacers" in the mask (for example, a hyphen or parenthesis) only work properly when the underlying data is numeric! For example,
>
>a = "9-999"
>b = 1234
>?transform(b,a) --> "1-234"

I'm very surprised that this works. It must have been that way in FoxPro @ GET PICTURE as well. I never used a PICTURE clause on a numeric GET other than to place a decimal or show commas and currency, so I wouldn't know.

Usually if there's formatting to be applied to a field, even if what's stored in it is digits, it should really be stored as character data type. The only time to store numeric data type is if you're storing a number you'll perform math on like "amount on hand" or price. And lately, primary keys are more efficient if stored as one of the new integer types. Phone numbers, zip codes, social security numbers, inventory "part numbers" as 12-345-6, etc., should be stored as strings.
Rich Addison, Micro Vane, Inc., Kalamazoo, MI
Relax, don't worry, have a homebrew.
- Charlie Papazian, The New Complete Joy of Home Brewing
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform