roundCur Method

Class: Number

Description

This method rounds an amount to the number of decimal places indicated by the specified currency. You can specify the type of rounding and justification as well.

Syntax

NumberObject.roundCur(String crcd,String roundOption,Number justify)

Parameters

crcd

The currency code that indicates the number of decimal places to include in the rounded value. The currency code must be defined in the CRCD table. If you do not specify a value, the configuration default is used. If the configuration does not have a default, the system rounds to two decimal places.

roundOption

A symbol that indicates the type of rounding. Valid values include:

  • "+" to round up

  • "-" to round down

  • "" to round to the nearest value. This is the default rounding option.

justify

The minimum length of the result. If necessary, spaces are inserted to the left of the rounded value. The default justification length is 0 (zero).

Returns

A String.

When Became Available

Profile v7.0

Example

// Define a Number

type Number AMT = 12.345

 

// assume site's currency "USD", which uses 2 decimals

type String S0 = AMT.roundCur()     // assigns "12.35"

type String S1 = AMT.roundCur(,"-") // assigns "12.34"

 

// Next example assigns " 12.34" (EUR uses 2 decimals too)

// Note the leading space in the result (to get 6 chars)

type String S2 = AMT.roundCur("EUR","+",6)