Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Choose a most effective approach
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00530049
Message ID:
00530056
Vues:
18
This message has been marked as the solution to the initial question of the thread.
>Hi everyone,
>
>I have a simple problem, but I want to solve it the best way, because I want to use it in a long scan loop. I have fields in a table called Low and High (8 char). I want to translate them into numbers. Val function would not give me correct results, if these fields contain non digit info. I'm not absolutely sure, how should I treat fields with non-digit chars in them.
>
>Suppose, I want to treat them as 0. What would you suggest?
>
>Thanks in advance.

Give this a try ...
IF TRANSFORM(VAL(cLowValue)) == ALLTRIM(cLowValue)
  nLowValue = VAL(cLowValue)
ELSE
  nLowValue = 0 && or skip them or do whatever else you want to do with non-numeric data
ENDIF
Cathy
Cathy Pountney, Microsoft Visual FoxPro MVP
Memorial Business Systems, Inc. (www.mbs-intl.com)

My Website: (www.frontier2000.com)
My Blog: (www.cathypountney.blogspot.com)
My Book: The Visual FoxPro Report Writer - Pushing it to the Limit and Beyond
Free MSDN Article: What's New in the VFP 9.0 Report Writer
Free MSDN Article: The VFP 9.0 Report Writer In Action
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform