Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Formating
Message
De
21/02/1999 15:30:49
 
 
À
21/02/1999 14:18:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00189809
Message ID:
00189820
Vues:
12
>Hi!
>
>I have a table called called ORDERS DETAIL and a field called DISCOUNT located inside that table. I want the field to only hold numbers b/w 0 and 1, and I would also like to have a percent sign appear each time a number is entered.
>
>So, in my field level validation box, I placed the expression:
>
>BETWEEN(ndiscount,0,1)
>
>That expression works just fine.
>
>However, I would like to use whole numbers with a percent sign instead. Currently, if I input 14, it would look like this:
>
>0.14

So what you really want is numbers between 0 and 100?

>But, I want it to look like 14%

Where do you want it to look like "14%"? In the table? If so, this is only possible with the character data type.

If you want to store a number between 0 and 1, but display a value like "14%", you will have to put some code in your textbox to handle this. First, use the input mask, not the format property of the textbox. set the box's input mask to "999%". In the box's Refresh method, put:
THIS.Value = TRANSFORM(MyTable.MyField * 100,"999%")

Then, in the box's valid method:
IF BETWEEN(VAL(THIS.Value),0,100)
    REPLACE MyTable.MyField WITH VAL(THIS.Value)/100
ELSE
    RETURN 0
ENDIF
Such a textbox should be unbound.

YOu can then keep your field level validation rule the way it is.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform