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.

...

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) }}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

...

Code Block
$Xml.SetValue('Test/testdate', new DateTimeOffset());  // testdate will be saved to an XML as "2015-11-12T15:27:16.2568549+02:00"
$Xml.SetValue('Test/testdate2', $Xml.Format("{{ format(Test/testdate,'yyyy-MM-dd') }}"));  // testdate2 will be saved to an XML as "2015-12-11"

// result : 2015-12-11

Text Masking

Template system also provides an mask function to filter displayed text on screen. This function can used to filter out personal data like name, credit card, identity number etc. More details can be found at mask function reference.

Code Block
{{ mask(DisplayName) }}					-> J*****D
{{ mask(CreditCard,4,4,'','-') }}		-> 1234-****-****-3456


Conditional Formatting

If conditional rendering is needed, the format below can be used:

...