Expressions
Basics
Expressions insert data on FX Reports.
You use expressions when creating templates to build FX Reports.
The following explains how to use expressions.
Inserting Field Data
Example: HTML Report
Use the following code to insert a table on a HTML report.
<table class="rpt-header">
<tr>
<th>{{labels.FX5__Job__r.FX5__CustomerAccount__c}}</th>
<td>{{FX5__Job__r.FX5__CustomerAccount__r.Name}}</td>
<th>{{labels.FX5__Job__c}}</th>
<td>{{FX5__Job__r.Name}}</td>
<tr/>
<tr>
<th>Job Number</th>
<td>{{FX5__Job__r.FX5__Tracking_Number__c}}</td>
<th>Ticket Number</th>
<td>{{FX5__Tracking_Number__c}}</td>
</tr>
<tr>
<th>Work Start</th>
<td>{{formatDateTime FX5__Work_Start_Date__c format="MM/DD/YY h:mm A"}}</td>
<th>Work End</th>
<td>{{formatDateTime FX5__Work_End_Date__c format="MM/DD/YY h:mm A"}}</td>
</tr>
</table>
Example: PDF Report
Use the following code to insert a table on a PDF report.
<table style="text" margin="36 40 36 40" columnWidths="* * * * * *" layout="noBorders">
<tableBody>
<row>
<cell bold="true">TICKET</cell>
<cell bold="true">JOB</cell>
<cell bold="true">CUSTOMER</cell>
<cell bold="true">LOCATION</cell>
<cell bold="true">WORK START</cell>
<cell bold="true">WORK END</cell>
</row>
<row>
<cell>{{FX5__Tracking_Number__c}}</cell>
<cell>{{FX5__Job__r.Name}}</cell>
<cell>{{FX5__Job__r.FX5__CustomerAccount__r.Name}}</cell>
<cell>{{FX5__Job__r.FX5__Office__r.Name}}</cell>
<cell>{{formatDateTime FX5__Work_Start_Date__c format="MM/DD/YY h:mm A"}}</cell>
<cell>{{formatDateTime FX5__Work_End_Date__c format="MM/DD/YY h:mm A"}}</cell>
</row>
</tableBody>
</table>
-
To insert field data, add a Handlebars expression inside double curly brackets
{{
}}
. -
To insert data from lookups, add
__r.Name
after the lookup’s name in the expression. -
To insert data from fields on a parent object, reference the parent object in the expression.
-
To insert data from a rich text area field, add a Handlebars expression inside triple curly brackets
{{{
}}}
.
Inserting Images
Example: HTML Report
Use the following code to insert an image on a HTML report.
<div class="rpt-logo">
<img alt="" src="data:image/jpeg;base64,ENTERBASE64STRINGHERE"/>
You must encode the image to a base64 string and enter the string in the src=
field. Replace ENTERBASE64STRINGHERE
with the base64 string for your image.
When you insert a corporate logo on a HTML report, you also need to add CSS code to specify the logo’s position.
.rpt-logo {
float: left;
margin: 0 .25in .25in 0;
}
Example: PDF Report
Use the following code to insert an image on a PDF report.
<header>
<image width="150">data:image/png;base64,ENTERBASE64STRINGHERE<image>
</header>
You must encode the image to a base64 string and enter the string in the <image>
element. Replace ENTERBASE64STRINGHERE
with the base64 string for your image.
Report Helpers
You can also use expressions inside report helpers.
Refer to the Report Helpers article for examples.