Inserting merge variables onto a layout
You can create a merge variable that displays a value from a variable. You can use merge variables for some tasks in place of global fields or unstored calculation fields. For example, a merge variable could display the total cost at the bottom of an invoice, or display the name of the account used to print a report.
You see the merge variable value in Browse, Find, and Preview modes, and when you print records.
To insert a merge variable onto a layout:
1.
FileMaker recommends that you create global variables for use as merge variables.
2.
For example, insert a merge variable into a text block or by itself on the layout.
Do not insert merge variables over a field or any other object that you want to view.
A placeholder merge variable (<<$$>>) appears on the layout.
3.
Click between the $$ and >> symbols in the placeholder variable, then type the merge variable name (the name of the variable you created in step 1).
Important  To ensure that merge values are displayed accurately, each record must be refreshed as it is being browsed, previewed, or printed. You can refresh records manually by, for example, creating a “Refresh” button that calls the Refresh Window script step, or automatically by creating a script that includes the Refresh Window script step.
Examples
 •
To create a merge variable named <<$$acctname>>, which displays the name of the user’s account, create the script step: Set Variable[$$acctname; Value: Get(AccountName)]. Then, insert the merge variable <<$$acctname>> on the layout.
 •
To create a merge variable named <<$$POnum>>, which appends the text “‑MPO” to the current record number to form a purchase order number, create the script step: Set Variable[$$POnum; Value: Get(RecordNumber) & “‑MPO”]. Then, insert the variable <<$$POnum>> on the layout.
 •
To display the current page number with the total number of pages in a report (for example, Page 1 of 10), start by creating a merge variable named <<$pp>>, and create the following script for it:
Enter Preview Mode
Go to Record/Request/Page [Last]
Set Variable [$pp; Value:Get(PageNumber)]
Go to Record/Request/Page [First]
Pause/Resume Script [Indefinitely]
Then, combine text, the page number symbol ({{PageNumber}}), and the merge variable on the layout header or footer:
Page {{PageNumber}} of <<$pp>>
Notes
 •
 •
 •
 •
 •
Related topics 
Creating scripts to automate tasks
Working with buttons and button bars on layouts