Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Integer or Real
Message
From
14/11/2012 12:29:13
 
 
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:
01557182
Views:
60
>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


You can check
? EMPTY(myField%1) && true then integer
or you can change the logic and rtrim(str()) zeroes and decimal point
Previous
Reply
Map
View

Click here to load this message in the networking platform