Create User-Defined Fields with the Field Builder
Often a report template requires fields that are calculated or derived from other fields. You can create user-defined fields using the field builder, as described in the following sections.
Create Fields with the Field Builder
1. In the Dynamic Template Designer, click Create Field.
Create a new field by combining several Alias Names into an expression, enclosed in: ${ }
Examples:
${A + B}
${A / (A+B)}
${F.time - E.time}
${A == 0 ? 'Success' : A == 1 ? 'Warning' : 'Error'}
Convert Dates to Numbers in the Field Builder
To calculate a time duration, such as the duration of a backup job, dates need to be converted to a numeric data type.
• Append a .time suffix to a field to convert the date to a number.
With this suffix applied, the result is the number of milliseconds that have elapsed since the epoch time (midnight of January 1, 1970).
Example of a Duration Calculation:
${D.time - C.time}
Where D is the Job Finish Time field and C is the Job Start Time field. Both C and D are date fields.
Syntax for Calculated Fields
Description | Syntax |
Adding | + |
Subtracting | - |
Multiplying | * |
Dividing | / |
If-then-else | (condition) ? (value if true) : (value if not true) |
Equality check | == |
Not equal check | != |
Greater than | > |
Less than | < |
Greater than or equal to | >= |
Less than or equal to | <= |
And (joining 2 conditions) | && |
OR (joining 2 conditions) | || |
Examples of Calculated Fields in a Dynamic Template
Note that all expressions need to be enclosed in the following format: ${ }
Description | Expression |
Display status ID having alias A and values 0, 1, 2 to display Success, Warning and Error. | ${A == 0 ? 'Success' : A == 1 ? 'Warning' : 'Error'} |
Add two numeric fields A and B. | ${A + B} |
Calculate percentage A from A and B. | ${A / (A+B)} |
Convert from A which is in KB to GB. | ${A / (1024 * 1024)} |
Calculate duration by subtracting values of date fields | ${G.time - F.time} |