[Working with Scripts‎] Java Script API Reference

Standard Javascript utilities can be easily referenced. Includes Formatting and Date Funtions.

Date
function offsetYears(origDate, numYears)

=Code Snippet=
offsetYears(new java.util.Date(), 4)

The above example returns system date (4 years ahead)

Download the DateFunctions sample here. Please change the following .txt to .jar


Number

String formatNumber(Number n, int decimalPlaces)

=Code Snippet=
Format.formatNumber(345886,5)

The above example returns 345,886.00000

String formatNumber(Number n, String pattern)

=Code Snippet=
Format.formatNumber(450000,"#0,K")

The above example returns 450K

*Note that pattern only allows '#,K' or '#0,K'%


Currency

String formatCurrency(Number n, String locale)

=Code Snippet=
Format.formatCurrency(12364,java.util.Locale("de","DE"))

The above example returns 12.364,00€