Functions
A few predefined functions are also available. The purpose of these will be obvious as stated below:
Variable | Usage | Description |
---|---|---|
formatDate | ${formatDate(entity.start)} | Prints a project date as per the format specified in the viewer's preferences. |
Date.format | ${Date.format(entity.startCalendar, "MM-MMMM")} | Prints the Month of project's start date. 11-November |
formatDateTime | ${formatDateTime(entity.start)} | Prints project date and time as per viewer's preferences. |
formatCurrency | ${formatCurrency(entity.budget)} | Prints a currency field prefixed with the currency symbol as specified in the company profile. |
formatNumber | ${formatNumber(entity.bcws)} | Prints a number as per the viewer's locale. Especially useful when printing floating pointing number. |
hoursToHHMM | ${hoursToHHMM(entity.estimatedHours)} | Prints hours in the form HH:MM. For example, ${hoursToHHMM(3.5)} will print 3:30 |
ceil | ${ceil(5.3)} | Returns the nearest integer larger than the input. For example ${ceil(5.3)} will return 6 |
floor | ${floor(4.8)} | Returns the nearest integer smaller than the input. For example ${floor(4.8)} will return 4 |
abs | ${abs(-3.2)} | Returns the absolute value of a number. For example ${abs(-3.2)} will return 3.2 |
round | ${round(3.6)} | Returns the rounded value of input. For example ${round(3.6)} will return 4 |
Date.now() | ${Date.now()} | Prints today's date. |
entity.created | ${entity.created} | Prints the created date of the entity. For e.g, the date when a project was created. |
Date.addDays(Date, days)Â | ${Date.addDays(entity.Create_Invoice_Date, 30)} | Prints the date after adding the entered days. For example, Create_Invoice_Date is a custom field having a date 13-Oct-2015. So adding 30 days will result in 13-Nov-2015. |
.before .after .equal | ${entity.New_DueDate).after(entity.completed) : 'OnTime' ? 'Delayed'} | Prints On Time or Delayed after comparing first date with second. |
Date.isoToDate('date')Â | Date.isoToDate('2016-12-01')Â | Displays date as per your Display date format. |