Expressions
Introduction
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: 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: 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.