Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Integer or Real
Message
From
14/11/2012 09:18:45
 
 
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:
01557145
Views:
65
>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 you don't get into scientific notation ( eg 1.23E22), then
function DecimalPlaces(n)

	return  mod(30 - rat('.', padl(m.n, 30)), 30)
endfunc
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform