>Hi,
>Thank you.
>Just for your info, SET DECIMAL TO 2 will cause TRANS(10) return "10.00" but not 10.
>
>Thank you
Because of some inconsistent results, it may be convenient to write your own UDF to replace the use of transform() with a single parameter. (transform with the additional picture parameter is quite trustworthy, AFAIK; for instance: transform(SomeNumber, "###,###.##")
If you don't need decimals, you can use alltrim(str(10)).
Otherwise, to show only those digits that are required, you can use something like he following function, which I quickly built together right now (which means it isn't thoroughly tested):
FUNCTION MyTrans(tnNumber)
local lcResult
lcResult = alltrim(str(tnNumber, 20, 10))
lcResult = strtran(lcResult, "0", " ")
lcResult = alltrim(lcResult)
lcResult = strtran(lcResult, " ", "0")
if left(lcResult, 1) = set("point")
lcResult = "0" + lcResult
endif
if right(lcResult, 1) = set("point")
lcResult = left(lcResult, len(lcResult) - 1)
endif
return lcResult
ENDFUNC
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)