Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Integer or Real
Message
 
 
To
14/11/2012 08:55:23
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Miscellaneous
Thread ID:
01557140
Message ID:
01557141
Views:
70
>Hi
>
>What's the easiest way, programmatically in code, to determine if a variable/field is a real or integer? I have code, which loops through fields in a database, and I'm using str(myField) to convert it for a report. Obviously, if it's a real number I want decimal places str(myField,2), but if it's a real than I don't need/want the decimal places. The issue is that type('myField') returns 'N' for either real or integer.
>
>Thanks in advance

If MyField = cast(MyField as I)

then you know that even if this is a real number, it doesn't have digits after .
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform