The A-Z of FileMaker: O is for Objects

FileMaker layouts are designed using objects. Layouts do not contain data – they present data which is displayed using objects such as fields and text.

Layout mode

One of the four modes available in FileMaker Pro, Layout mode is where you design the layout structure and ultimately control what is displayed in Browse, Find and Preview modes. The structure of the layout is controlled using layout parts (body, header, footer, etc). Layout objects are placed on (or in) those parts.

Layout object tools

In Layout mode, the status toolbar provides the tools to manage and create objects:

layout tools for creating objects

The first tool is the selection tool. This is not used to create objects but to select, move and resize them. When an object is selected, it displays eight grab handles that are used to resize the object.

Select multiple objects

Click the first object, hold down the Shift key and then click other objects. Alternatively, drag the mouse across objects to select any object touched.

The next set of three tools are for text, lines and shapes. These objects are used to annotate and add design elements to layouts. Text is used for headings and labels. While text is usually static, it can also include merge fields and variables for dynamic display.

Multiple tools

Any tool with a triangle in the lower right has multiple tools available. Click and hold the tool button to select other tools.

layout tools multiple

The next set of seven tools are for fields, buttons, button bars, panel objects, portals, charts and web viewers.

Fields

Field objects can be added to the layout in a number of ways. They are commonly added using the Field Picker as standard edit boxes. Their control style may then be altered via the Data panel of the Inspector. However, the status toolbar provides tools to directly create a field object using any control style.

field controls

Buttons

Two types of button objects are available: buttons and popover buttons.

When a button is drawn the Button Setup dialog provides options:

button setup

A button can have an icon, static text label or both. The button action can be to Do Nothing, run a Single (script) Step, or to Perform Script.

A popover button has two parts – the button and the popover area. When the button is clicked in Browse mode, the popover area appears over the top of layout objects. The Popover Button Setup dialog provides options:

popover button setup

The button can have an icon, static text label or both. The preferred position of the popover area relativise to the button can be set. The popover area has an optional title bar with a dynamic title. Script triggers can be defined for the popover.

Button bars

A button bar is a layout object made up of one or more segments. A new button bar is created with three segments. Segments can be displayed horizontally or vertically. Each segment can be defined as either a button or a popover button. Unlike standard buttons and popover buttons, the text label can be dynamic.

button bar setup

Panel controls

There are two types of panel controls – tab and slide. Each panel is an independent area occupying the same space on the layout. Only one panel in any control can display at any time. For a tab control, the default front panel is defined in the setup and will be the panel displayed when the layout is loaded. For a slide control, the first panel is the default.

tab and slide panel objects

Tab panels display tabs across the top. The user switches between panels by clicking each tab. The tab names can be dynamic.

Slide controls have optional navigation dots below for switching between panels. On a touch device, the user may be able to swipe panels left and right.

Portals

Portals are used to display lists of records related to the current record. For example, a portal on a student layout could display a list of all enrolled subjects for the current student. The related records may display in a defined sort order and they can be filtered according to a defined test. The number of portal rows is set for the portal and the portal is usually set to scroll to access more rows.

Charts

Charts are used to pictorially display data to easily identify trends and relationships in data. FileMaker Pro provides several chart types (column, bar, pie, line, area, scatter, bubble) and a range of styling options.

Web Viewers

A web viewer is commonly used to push data to a web service and have that service return information to be displayed in the object. A simple example is passing address data to Google Maps and displaying the address location on a map. Web viewers can take advantage of many web technologies to extend the capabilities of FileMaker displays.

The A-Z of FileMaker: M is for Merge

There are a number of methods to display data on a FileMaker layout, the most common being using field objects. Often it is more convenient and flexible to use merge items within a text object.

What can be merged in text?

Text objects can contain three types of merge data:

  • fields
  • variables
  • symbols

All can be accessed via the Insert menu while working in Layout mode.

Insert menu merge

What do merge items look like?

When looking at a text object in Layout mode, merge fields and variables in the text appear within double chevrons <<like this>> and <<$likethis>>; merge symbols are enclosed in double curly braces {{like this}}.

merge items in layout mode

Merge fields

When inserting merge fields, you can specify any field that you could physically place on the layout (current table, related or global). Text objects containing merge fields can be placed as you would normal fields – on the layout, in a portal, in a popover, etc – and will display the same data as it would for a standard field object.

The exception for using merge fields is container fields. If these are merged, the text object will display the container data file name.

Concatenating data

Merge fields can be very useful for stringing together (concatenating) data. A common example is when displaying a person’s full name – you will want a single space between first and last names or perhaps a comma and space between last and first names. This can be done using a calculation field but merge fields for display may save creating a number of calculations.

concatenate with merge

Note also in the above that the merge fields have been formatted with styling (bold and uppercase) within the text object.

Merge variables

You can insert both local ($) and global ($$) variables in text objects. The value of a local variable will only be displayed during the script in which it exists.

To ensure correct display, you will need to use either the Refresh Window or Refresh Object (specifying the named text object) script step.

Tip: Displaying page count

As in the above screenshot, you may want to display the page count in the footer of a report – Page 3 of 10. While the page number is displayed with a symbol, the page count is determined dynamically for the report. When in Preview mode, you will go to the last page using the Go to Record/Request/Page [Last] script step, and set a variable to Get ( PageNumber ).

Idea: use Merge variables as Layout calculations

There have been various feature requests over the years for layout calculations. This feature would reduce the need for calculation fields in tables. Merge variables may satisfy that request in a number of cases. During a script, you can define a variable using any calculation. Then you can display the result of the calculation on a layout using a merge variable.

Merge symbols

Merge symbols use the Get functions available in the calculation engine (see the blog article The A-Z of FileMaker: G is for Get for more). If the function used is Get (AccountName), then the merge symbol is {{AccountName}}.

The merge symbol displays the result of the Get function in Browse, Find and Preview modes. It is evaluated when the text object is drawn on the layout and when it is refreshed.

Challenge

If the {{CurrentTime}} merge symbol is placed on a tab panel that is not the default front tab, when will the current time be evaluated?

a. when the layout first loads
b. when the tab panel is first selected
c. every time the tab panel is selected
d. when any tab panel is selected

(answer is at the end of the article but you would be wise to experiment for yourself to see whether your results agree)

The most commonly used merge symbols are available for immediate selection – date, time, user name, page number and record number. All others can be accessed through the Other Symbol… command and dialog.

Formatting merge data

Data displayed by merge fields, variables and symbols can be formatted for display by applying Data Formatting via the Inspector to the text object.

Only one format per data type (number, date, time) can be applied to a single text object. This means that it is not possible to have two numbers in a single text object display with different formatting.

CHALLENGe Answer

b. when the tab panel is first selected

After that event, it will not be re-evaluated except if the window or object is refreshed. If the window is refreshed and the tab panel is not active, then it behaves as it does when the layout is first loaded – it evaluates next time the tab panel is selected.

Why is this useful to know? It contributes to an understanding of how FileMaker draws layouts and layout objects, and when it evaluates calculations. Such understanding will help a developer to create efficient layouts and troubleshoot performance.