Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Data templates transform the data model into text or HTML content. Templates are used in many areas in emakin like form controls or mail templates etc.

...

All text or string types are exactly transformed without any formatting being performed.

On the other hand, if a string node's value is a number, it automatically displays thousand separator dots.
To avoid this, pass 'string' as second argument to format function as below:

Code Block
languagexml
titleFormatting String
{{ format( 'Employee/RegistryNumber', 'string' ) }}

Number formatting

Functions like "Sum" or "Count" already return number values, therefore there is no need for number conversions, but in case it is necessary, number() function should be used. Ex: number(MyNumberField) 

...

TemplateOutputsCulture
{{ 12345678912345 }}12345678912345
{{ 123456.78912345 }}123456.78912345
{{ number(123456.78912345678912345) }}123456.789123457
{{ format( number(123456.789) ) }}123456.789
{{ format( number(123456789) ) }}123456789
{{ format( number(123456789), 'n') }}123,456,789.00
{{ format( number(123456789), 'n') }}123.456.789,00tr-TR
{{ format( number(123456789), 'n0') }}123,456,789
{{ format(number(123456789), 'c') }}123.456.789,00 ₺tr-TR{{ format(123.456.789, 'string') }}123456789

Date formatting

Template system automatically detects the xml date types formatted with "YYYY-MM-DD-THH:MM:SSTZ". Emakin always uses this format in data model for date values.

...

TemplateOutputsCulture
{{ MyDate }}01/31/2014 16:04
{{ format(MyDate,'MMM/yyyy/dd') }}Feb.2018.04
{{ format(MyDate,'MMM/yyyy/dd') }}Şub.2018.04tr-TR
{{format(MyDate, 'MMMM yyyy')}}Nisan 2021tr-TR
{{ format(MyDate) }}31/01/2014 09:00
{{ format(MyDate) }}31.1.2014 09:00tr-TR
{{ format(MyDate,'d') }}31/01/2014
{{ format(MyDate,'D') }}Monday, June 15, 2009en-US
{{ format(MyDate,'o') }}
2014-01-31T09:00:00+02:00

...