>Hi Folks,
>
> My requirement is to know the number of decimal places in a numeric expression.
>For example
>
>Passing 123.456 should return 3
> 13.234533 should return 6
>
>Thanks in advance
>
>Jayesh
Hi,
Here's a function to do what you want. It could be done as a one-line expression but it would be quite long.
FUNCTION LenDecimals
LPARAMETER tnTestNum
LOCAL lcNumber, lnPos, lnResult
lcNumber = LTRIM( PADL( tnTestNum, 99))
lnPos = AT( ".", lcNumber)
IF lnPos = 0
lnResult = 0
ELSE
lnResult = LEN( lcNumber) - lnPos
ENDIF
RETURN lnResult