Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bug in PADL command?
Message
 
 
To
31/05/2006 20:02:34
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01126320
Message ID:
01126361
Views:
11
>>Hi everybody,
>>
>>yAmount is a currency field.
>>
>>PADL(yAmount,9,'0') returns an empty string.
>>PADL(CAST(yAmount as Numeric (9,2)),9,'0') returns the result correctly.
>>
>>Looks like a bug to me.
>
>Borislav has pointed out why this happens, but it still looks like at least a doc problem to me, if not a bug. Currency is supposed to be a valid type in the expression.
>
>It looks like the currency gets implicitly converted to a width of 21 characters, with leading spaces. If you specify anything less (e.g. length "n"), what you get back is the first n characters of that 21 character string. If you specify more than 21, you get the 21-length converted currency number with leading zeroes. For example
>
>PADL( $123.4567, 25, "0" ) -> "0000             123.4567"
>PADL( $123.4567, 23, "0" ) -> "00             123.4567"
>PADL( $123.4567, 21, "0" ) -> "             123.4567"
>PADL( $123.4567, 19, "0" ) -> "             123.45"
>PADL( $123.4567, 16, "0" ) -> "             123"
>PADL( $123.4567, 14, "0" ) -> "             1"
>...etc.
>
Al, thanks a lot.
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