Tom, I ran this with your two test values, and got the answers you wished. If you expand it to include the lesser values, it should work for you. It might run faster as a stored procedure. You will need to test this will all possible alternatives, of course.
-------------------------
SET VAR v1 CURRENCY = 1.74
SET VAR v2 CURRENCY = 1.76
SET VAR v3 CURRENCY = (.v1 - (INT(.v1)))
IF v3 BETWEEN 0.51 AND 0.74 THEN
    SET VAR v1 = (INT(.v1) + .5)
ENDIF
IF v3 BETWEEN .76 AND .99 THEN
    SET VAR v1 = (INT(.v1) + 1)
ENDIF

SET VAR v3 CURRENCY = (.v2 - (INT(.v1)))
IF v3 BETWEEN 0.51 AND 0.74 THEN
    SET VAR v2 = (INT(.v2) + .5)
ENDIF
IF v3 BETWEEN .76 AND .99 THEN
    SET VAR v2 = (INT(.v2) + 1)
ENDIF
SHOW VAR
RETURN
--------------------------------------
Albert

On 29/08/2011 3:17 PM, TOM HART wrote:
Is there a way to round currency to the nearest .50, what I want to do is round currency the the nearest dollar or .50
eg

$1.76        to        $2.00
$1.74        to        $1.50
etc

Tom Hart


--- RBASE-L
================================================
TO POST A MESSAGE TO ALL MEMBERS:
Send a plain text email to [email protected]

(Don't use any of these words as your Subject:
INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: INTRO
================================================
TO UNSUBSCRIBE: Send a plain text email to [email protected]
In the message SUBJECT, put just one word: UNSUBSCRIBE
================================================
TO SEARCH ARCHIVES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: SEARCH-n
(where n is the number of days). In the message body, place any text to search for.
================================================


Reply via email to