The picture clause function $pce.format can be applied to content in a template. A picture clause is a sequence of characters that specify rules for how to parse and format textual data such as dates, times and numbers. When processing the template, the picture clause determines how to transform raw data values into formatted values.
$pce.format(<clause>, <input>[, <locale>])
A locale must be defined when using the $pce.format function. The locale determines for example how to format date and currency for different languages. You can specify a default locale when you configure the Template Engine Process in Design Center. To use the default locale in the
$pce.format function you only have to specify which picture clause to use and the content to apply the picture clause to. If you want to override the default locale, or if it is not specified, you must add a locale as argument to the
$pce.format function.
You can use the function $pce.defaultLocale to get the default locale (if specified). For example, if you add this function to your template, the default locale will be displayed in the output.
#set($input = '12345.6789')
Input number: $input
Clause .9: $pce.format('.9', $input)
Clause .99: $pce.format('.99', $input)
Clause 9.9: $pce.format('9.9', $input)
Clause 9.z: $pce.format('9.z', $input)
Clause z.9: $pce.format('z.9', $input)
Clause zz,zz9.9: $pce.format('zz,zz9.9', $input)
Clause zz,zz9.99: $pce.format('zz,zz9.99', $input)
Clause zz,zz9.9z: $pce.format('zz,zz9.9z', $input)
Clause zz,zz9.99z: $pce.format('zz,zz9.99z', $input)
Input number: 12345.6789
Clause .9: 12345.7
Clause .99: 12345.68
Clause 9.9: 12345.7
Clause 9.z: 12345.7
Clause z.9: 12345.7
Clause zz,zz9.9: 12,345.7
Clause zz,zz9.99: 12,345.68
Clause zz,zz9.9z: 12,345.68
Clause zz,zz9.99z: 12,345.679
#set($input = '12345')
Input number: $input
Clause .9: $pce.format('.9', $input)
Clause .99: $pce.format('.99', $input)
Clause 9.9: $pce.format('9.9', $input)
Clause 9.z: $pce.format('9.z', $input)
Clause z.9: $pce.format('z.9', $input)
Clause zz,zz9.9: $pce.format('zz,zz9.9', $input)
Clause zz,zz9.99: $pce.format('zz,zz9.99', $input)
Clause zz,zz9.9z: $pce.format('zz,zz9.9z', $input)
Clause zz,zz9.99z: $pce.format('zz,zz9.99z', $input)
Input number: 12345
Clause .9: 12345.0
Clause .99: 12345.00
Clause 9.9: 12345.0
Clause 9.z: 12345
Clause z.9: 12345.0
Clause zz,zz9.9: 12,345.0
Clause zz,zz9.99: 12,345.00
Clause zz,zz9.9z: 12,345.0
Clause zz,zz9.99z: 12,345.00
#set($clDate='date.full{}') #set($inDate='20131224')
#set($clCurr='num.currency{}') #set($inCurr='3489')
Default locale: $pce.defaultLocale
DateDefaultLocale: $pce.format($clDate, $inDate)
CurrDefaultLocale: $pce.format($clCurr, $inCurr)
DateUSlocale: $pce.format($clDate, $inDate, 'en_US')
CurrUSlocale: $pce.format($clCurr, $inCurr, 'en_US')
Default locale: sv_SE
DateDefaultLocale: Tisdagen den 24:e december 2013
CurrDefaultLocale: 3 489,00 kr
DateUSlocale: Tuesday, December 24, 2013
CurrUSlocale: $3,489.00