Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Number to string
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00567085
Message ID:
00567086
Views:
9
Nick,

Str() function has three parameters and third one determines home many digits will be after decimal point. By default its 0. Use STR(&cCursor..retire_amt,10,2) to get exactly 2 decimal points or use TRANSFORM(&cCursor..retire_amt). BTW, the second parameter of STR() function is the length of the result string and it's 10 by default.

>I create a cCursor4 that hold character values. I have another cursor (cCursor) that contains numeric values. When I insert the number values from cCursor to cCursor4 character values using STR, it only picks up the first number.
>
>for example if I have 345.60, it picks up just 3
>
>here is my code:
>
>create cursor (cCursor4)(c1 c(7), c2 c(25), c3 c(8), c4 c(8), c5 c(8), ;
> c6 c(8), c7 c(8), c8 c(8), c9 c(8), c10 c(10))
>
>insert into (cCursor4) (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10) ;
>values(&cCursor..pp, &cCursor..fname, STR(&cCursor..totpay), STR(&cCursor..fica), ;
>			 STR(&cCursor..retire_amt), STR(&cCursor..health_ins), ;
>			 STR(&cCursor..retiree_med), STR(&cCursor..unempins), ;
>			 STR(&cCursor..wrkcompins), STR(&cCursor..total_salary))
>
>
>
>Shouldn't string convert 345.60 to "345.60" ?
>
>Thanks
>Nick Patel
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform