Simple Item Formatting
Sometimes (a lot of the time!) back-office systems provide data in a format that you wouldn't want to show the customer. E.g.
E.g. Next Payment Date for Benefits is returned with a timestamp:
01/01/2017 00:00
So clearly we want to be able to cut that out.
Within the editor it is possible to format the answers using extra snippets of text.
Convert a date to drop the timestamp
The following illustrates the Next Payment Date example above. One can see that to remove the timestamp the highlighted part needs to be added to the end of the Data Field in question:
${NextPayment.Date.ToString(“dd/MM/yyyy")}
I.e. copy and paste this: .ToString(“dd/MM/yyyy") to the end of the template field that is a date.
You can break a date into its constituent elements:
The following will convert the date into just the date of the month:
${Claim.Hb.Entitlement.StartDate.ToString(“dd")}
This will convert the month e.g. 10 to the month into the word October
${Claim.Hb.Entitlement.StartDate.ToString(“MMMM")}
And this will change the date to only show the year e.g. 2018
${Claim.Hb.Entitlement.StartDate.ToString("yyyy")}
Convert a long decimal to only have two decimal places
In some cases the back office APIs actually provide an answer like this: 1244.0323232
Whereas obviously you would want the customer to see: 1244.03
The following will ensure that this formatting is applied to the value:
${PropertyBand.FullYearCharge.ToString("f2")}
The following illustrates examples of this:
What to add
Example
What it changes it to
.ToString("C")
100
£100.00
.ToString("F2")
100
100.00
.ToString("dd/mm/yyyy")
03/12/2018 00:00:00
03/12/2018
.ToString("dddd, dd MMMM yyyy")
03/12/2018 00:00:00
Monday, 3 December 2018
E.g. Adding .ToString("dd/mm/yyyy") to the end of the Data Item NextPayment.Date:
This ensures the date will be presented like 03/08/2021 not 03/08/2021 00:00:000 which is what we get from Civica and Northgate systems.
Last updated
Was this helpful?