Check
Re: The 10 multiple immediately higher than a number Thread #
1492886 Message #
1492887 and try to apply a similar solution (although reversed).
>Hi Gang!
>
>I have some data to convert over, and the data has a field in it, for Retail Price.
>
>It is a character field, and has amounts like this.... '2/9.99'
>
>So this is 2 for 9.99.
>
>I assume they want it to show 4.99, but here is my code I have at the moment (I threw together)....
>
>
>LOCAL lnSlash, lcDivider, lnDivider, lcAmount, lnAmount
>
>_SCREEN.Show
>SET STEP ON
>
>lnSlash = 0
>lcDivider = ''
>lnDivider = 0
>lcAmount = ''
>lnAmount = 0
>
>CLOSE DATABASES
>USE "c:\windmill 12-7-10-1" EXCLUSIVE
>GO top
>DO WHILE NOT EOF()
> IF '/' $ retail
> lnSlash = ATC('/',retail)
> IF lnSlash > 0
> lcDivider = LEFT(retail,lnSlash -1)
> lnDivider = VAL(lcDivider)
> lcAmount = SUBSTR(retail,lnSlash + 1)
> lnAmount = VAL(lcAmount)
> IF lnDivider <> 0
> lnAmount = lnAmount / lnDivider
> ENDIF
> lcAmount = ALLTRIM(STR(lnAmount,15,2))
> REPLACE retail WITH lcAmount
> ENDIF
> ENDIF
> SKIP
>ENDDO
>
>
>and the lcAmount comes out as 5.00, not 4.99.
>
>So.... any suggestion to make the amounts round down to the lower penny amount?
>
>Thanks!
If it's not broken, fix it until it is.
My Blog