The A-Z of FileMaker: R is for Recursion

The trite definition of recursion is “see recursion”. And further, that to understand recursion, one must first understand recursion!

According to the online Dictionary of Technical Terms, recursion is:

“…a process in which a function calls itself as a subroutine. This allows the function to be repeated several times, since it calls itself during its execution.”

FileMaker custom functions

In FileMaker programming, recursion is possible when creating custom functions. The definition of a recursive custom function will include the function itself. So the function is said to “call” itself when it evaluates an expression.

Care must be taken when designing recursive custom functions – they will need an exit point. If there is no valid exit point, the function will keep calling itself infinitely or until all memory is consumed. FileMaker custom functions will only allow a specified number of recursions until they exit and return ?.

Why do I need recursion?

Good question. There are some problems that require the same process to be repeated an indeterminate number of times.

A simple mathematical concept is the factorial – denoted by n! – the product of all positive integers less than or equal to n:

5! = 5 x 4 x 3 x 2 x 1 = 120

This could also be considered as

5 x (5 - 1) x (5 - 2) x (5 - 3) x (5 - 4)
n . (n - 1) . (n - 2) ... 2 . 1

The generalised process is:

n! = n . (n - 1)!

The factorial process takes the first number and multiplies it by the factorial of itself minus 1 until the last multiplier is 1. Clearly, the reason this needs recursion is that there will be the same number of multiplications as the value of the initial number.

How do we write a custom function in FileMaker Pro?

Well, first you need FileMaker Pro Advanced. This will provide access to File > Manage > Custom Functions…. When you create a new custom function, you will use the dialog box:

edit custom function

You give your custom function a name, create as many parameters as you need and define the function.

(As it happens, FileMaker Pro already provides a function called Factorial so you cannot use that name here.)

So here is my factorial custom function, Factorial_c:

factorial custom function

There is one parameter – number. Looking at the function definition:

Case ( number < 0; "?"; 
     number = 0; 1;  
     number > 1; number * Factorial_c ( number - 1); 
     1 )

It uses a Case function to test for multiple outcomes. The first test returns an error (?) if the number provided is negative.

The second test provides the special case where 0! = 1.

The third test is where the recursion occurs – for any number greater than 1, it multiplies that number by the factorial of the number one less than itself. Highlighted in bold is where the function calls itself.

The function has three exit points – when the number is less than zero, zero, or one. Otherwise, it will call itself.

Note: for simplicity, this function does not explicitly account for non-integer numbers.

So if the number passed was 4, the process goes:

Expression:   Factorial_c ( 4 )
First pass:   4 * Factorial_c ( 4 - 1)
Second pass:  4 * 3 * Factorial_c ( 3 - 1)
Third pass:   4 * 3 * 2 * Factorial_c ( 2 - 1)
Fourth pass:  4 * 3 * 2 * 1
Exit Result:  24

Is there a more practical example?

If you are not mathematical, well done for hanging in there! For your reward, here is a more practical example of recursion.

There may be cases where you need to create an acronym of a phrase. For example, Australian Computer Society would return ACS.

So we create a custom function called Acronym ( text ) with one parameter, text, and defined as:

Upper ( Left ( text; 1) ) &
If ( WordCount (text) > 1;
   Acronym ( RightWords (text; WordCount(text)-1) )
   )

The recursion (highlighted in bold) simply takes the current string less the first word (by getting the all the words from the right except the first one).

The custom function calls itself whenever the word count is more than one. The exit point is when the text has one word (or less).

So if the text passed was “new south wales”, the process goes:

Expression:   Acronym ( "new south wales" )
First pass:   "N" & Acronym ( "south wales" )
Second pass:  "NS" & Acronym ( "wales" )
Exit Result:  "NSW"

To reiterate, this recursive custom function will work for a string of any* number of words. That is the beauty of recursion in the efficiency of the code.

Bonus points

For bonus points, it would be useful if the acronym ignored certain words like and, of, &, etc. For example, the Australian Bureau of Statistics should be ABS rather than ABOS.

How could you modify the function to ignore defined words? Perhaps using the Substitute function?

* Recursive limits in FileMaker

As mentioned above, the FileMaker calculation engine will allow a certain number of recursions before exiting with an error (?). For standard recursion, this limit is 10,000. For the special case of tail recursion, the limit is 50,000.

So what is standard recursion? It is when the calculation engine needs to preserve a previous result (in a stack) for each recursion. Both examples above do this. For the acronym function, the calculation engine needs to remember all the previous letters while it runs the next acronym recursion on the shorter text string. When the exit point is reached, the result is returned from the stack.

Then what is tail recursion? This is when a stack is not used because the entire result is passed to the next recursion. Each recursion is complete in its own right.

Here is an example of tail recursion for the Acronym function. The structure of the function is Acronym_t ( text ; result ). When using the function, the result always starts with a null value (“”). The result passed onto the next recursion is the progressive accumulation of the final result.

If ( WordCount (text) > 1;
   Acronym_t ( RightWords(text;WordCount(text)-1); 
               result & Upper(Left(text;1)) ); 
   result & Upper ( Left ( text; 1) ) 
   )

The process goes:

Expression:   Acronym_t ( "New South Wales"; "" )
First pass:   Acronym_t ( "South Wales"; "N" )
Second pass:  Acronym_t ( "Wales"; "NS" )
Result:       "NSW"

Creating tail recursive custom functions requires a little more thought and effort. However, it is sometimes important to be able to exceed the standard 10,000 pass limit.

But I still don’t understand recursion!

Well then you need to read this article – The A-Z of FileMaker: R is for Recursion. See what I did there? :p

The A-Z of FileMaker: Q is for Quick Find

Quick Find searches records across multiple fields on a layout. This provides quick and easy searches of a FileMaker table much like Google searches work. This search method will often be sufficient for most user requests.

Using Quick Find (Browse mode)

Unlike standard searches in FileMaker Pro, Quick Find operates in Browse mode.

quick find browse

The user simply types their search criteria into the Search box in the status toolbar and presses Return/Enter to search. Matching records are found instantly.

The Quick Find operation searches all fields on the current layout except for summary, container and global fields. Quick Find will also search fields that are on the layout as merge fields (in a text object). Quick Find will search fields that are placed to the right of the explicit right edge of the layout (and therefore not visible or accessible in Browse mode).

FileMaker Pro provides access to recent Quick Finds via the down arrow in the search box:

quick find recent

Field indexing

The default indexing option for new fields in any table is None and Automatically create indexes as needed. This means that when Quick Find is first run, all fields on the layout will be indexed and will continue to maintain a field index. This can have consequences for file size where tables have large numbers of records and where fields have large indexes.

Search Operators

If you type more than one word in the search box, this perform a logical AND search for records that have all of the words typed. The only search operator supported by Quick Find is the match phrase operator (” “). This enforces a search for a specific string of text from the start of a word.

For example, searching for leichhardt street will find all records containing both the words leichhardt and street across any fields on the layout (not necessarily in the same field). Searching for “leichhardt street” will only find records with the exact phrase in any field.

Configuring Quick Find

Configuration is specific to a layout. When in Layout mode, choose Layouts > Layout Setup….

The checkbox at the bottom of the General tab in the dialog allows you to Enable Quick Find (uncheck to disable). If Quick Find is disabled, the Search box in the status toolbar is not accessible for that layout.

In Layout mode, show the Quick Find badges for fields on the layout by enabling View > Show > Quick Find. A small badge next to each field shows the Quick Find status.

quick find badges

A green badge shows the field is searchable. In the above screenshot, the First field and the text object containing Group merge field show green badges.

A yellow badge shows the field is searchable but that the search may take longer. The Title field above has indexing set to None. The Full Name field is an unstored calculation field. The yellow badge would also be shown for related fields on a layout.

The Photo Container field has no badge because it is not supported for Quick Find. The Last field has no badge because it has been excluded from Quick Find in the Data tab of the Inspector.

In summary, FileMaker Pro provides control of Quick Find for the entire layout and for individual fields on the layout. Use this to fine tune the behaviour of Quick Find for the user experience.

Scripting Quick Find

The Perform Quick Find script step allows you to craft a script to provide customised access to Quick Find. This may be via a global field on the layout rather than using the search box in the status toolbar. The user interface may be neatly presented in a popover or a card window.

The A-Z of FileMaker: P is for Parameter

A parameter is text that is passed to a FileMaker script when it runs. The text is often used to make decisions during the script. Using a script parameter allows the developer to construct a script that can run differently according to the conditions.

Running a script

A script can be called to run in a number of ways:

  • user clicks a button
  • event occurs such as switching layouts
  • user selects a script in the Scripts menu
  • script runs the Perform Script or Perform Script on Server step
  • FileMaker Server schedule runs a script
  • user selects a custom menu item defined to run a script
  • timer running in a window runs a script

Passing a parameter

In most cases, when a script is called a parameter can be passed to the script. In the simple case of defining a button, when the action is to Perform Script, the (optional) script parameter can be defined in the lower part of the Specify Script dialog:

specify script dialog

The Edit… button provides access to the FileMaker calculation engine such that the script parameter can be a calculated result determined when the script runs.

Parameter is text

It is important to understand that a script parameter is passed as text. This can have important implications when the data is expected to be used as number or date. It also means that raw container field contents cannot be passed as parameters – they must first be converted to text (e.g. using Base64 encoding).

Accessing a parameter

A parameter passed to a script is available only within that script. It can be accessed at any time using the Get ( ScriptParameter ) function.

For convenience, a developer may choose to extract the parameter into a variable (or multiple variables) at the start of the script. This can provide a readable name for the parameter making code more self-documenting.

For example, if the script parameter being passed is the name of a customer and that data will be used to name a new card window, the following code might be used:

New Window [ Style: Card; Name: Get(ScriptParameter);                   Using layout: “Contact Details”]

Without knowing the contents of the script parameter, it is impossible to know how the window will be named. Compare that with the following:

Set Variable [ $customerName; Value: Get(ScriptParameter)]
New Window [ Style: Card; Name: $customerName; 
             Using layout: “Contact Details”]

It is now clear that the new card window will be given the customer name.

Conditional scripting using a parameter

A parameter may be used to control how a script runs.

One example is when the parameter is queried in an If script step. The parameter may contain contextual data such as where the script is being run. Depending on the layout, the script may run different script steps.

For example, the parameter could be set with the Get(LayoutTableName) function. This returns the table occurrence name of the current layout.

set script parameter to layout table

If the table occurrences underlying each layout are named using a naming convention where the first word is the name of the table, this can be used to run different script steps based on the layout where the script was called.

Set Variable [ $table; 
   Value:LeftWords(Get(ScriptParameter) ; 1 )]
If [ $table = "person" ]
   #do these steps
Else If [ $table = "invoice" ] 
   #do these steps
Else If [ $table = "product" ] 
   #do these steps
End If

Similarly, if the parameter contained a number, this could be used to control a loop. This might be to control the number of new records created or the number of records to be processed.

Passing multiple parameters

In most cases, it is sufficient to pass one piece of data as a parameter. To pass more than one parameter, you need to think about how to bundle up multiple pieces of data and then unpack them in the script.

A common method is to use the List function to create a return separated list of values. Knowing the number and order of the values, you can effectively unpack the data into different variables in the script.

For example, if a person’s first name, last name and student number is passed using the List function:

List ( person::First; person::Last; person::StudentNo )

This could be unpacked in the script thus:

Set Variable [ $p; Value: Get ( ScriptParameter ) ]
Set Variable [ $first; Value: GetValue ( $p; 1 ) ]
Set Variable [ $last; Value: GetValue ( $p; 2 ) ]
Set Variable [ $studentno; Value: GetValue ( $p; 3 ) ]

It is also possible to adopt a more structured approach and pass data in a parameter as name/value pairs. This is easily done in FileMaker Pro 16 using JSON format and extracting the data from the parameter using the new JSON functions.

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.

Brisbane training courses scheduled

We have been running a survey asking for expressions of interest in alternative locations for our FileMaker training courses. We currently offer FileMaker training in major centres where demand is highest. But we can travel anywhere there is demand.

If you would like to attend FileMaker training closer to you, please complete our online survey. There is no obligation to enrol. We will schedule courses in locations where there is a good expression of interest. You can still complete our survey here.

Brisbane Wins!

As a result of our current survey responses, we have scheduled new FileMaker training courses in Brisbane in late October. We are still negotiating a venue somewhere in the CBD area. Course descriptions will be updated as soon as this is confirmed.

Get Started with FileMaker Pro
Brisbane CBD location (to be advised)
Mon-Tue, 23-24 October 2017
Building Effective FileMaker Solutions
Brisbane CBD location (to be advised)
Wed-Thu, 25-26 October 2017

These two day courses are at an introductory and intermediate level respectively. Course details including outlines and videos can be found on the Training page.

Bookings are open now for both courses and can be made through the Training Schedule.

Prepare for FileMaker Developer Certification – now in Melbourne

Due to popular demand, the Prepare for FileMaker Developer Certification has been moved to a Melbourne CBD location.

The course is an intensive advanced level course designed to prepare candidates for the Developer Essentials for FileMaker 16 exam. The course covers all knowledge areas of the exam paying attention to the approximate weighting for each.

When and Where

It runs for two full days – Mon 25 & Tue 26 September 2017. The location has not yet been finalised but will be in the Melbourne CBD and likely to be at Ether Conference Venue at 265 Little Bourke St, Melbourne.

The course cost is AU$1190 but there is an Early Bird Special – AU$990 – running until 31 August 2017.

So get in now to book your place and save $200.

WHO SHOULD ATTEND?

This course is designed for people preparing to sit the Pearson VUE exam to achieve the certification as FileMaker 16 Certified Developer. The course does not aim to teach you about FileMaker development per se, but to look at what should be the knowledge and skills of a competent FileMaker developer across the entire FileMaker Platform. To gain the most from the course, you should have hands-on experience developing and deploying recent FileMaker solutions including installation, configuration and maintenance of FileMaker Server.

Course Details and Booking

For more details and to book online, please go to our Training Schedule page.

Get FileMaker 16 Developer Certification

Are you a FileMaker Certified Developer?
Why should you care? Why should your customers care?
How do you study for the Certification exam?

FileMaker Inc., has released the Developer Certification exam for the FileMaker 16 Platform. In their words:

“This credential demonstrates to clients, peers and management that you have achieved an essential level of knowledge, experience, and skills in developing on the FileMaker Platform.”

Candidates who pass the exam receive the FileMaker 16 Certified Developer credential.

Why get Certified?

This is the only industry certification available for FileMaker developers. While it does necessarily mean you are a great developer, it does give you the best chance of being great. Passing the exam means that you have a competent level of knowledge of the FileMaker Platform.

FileMaker Inc., lists the benefits of Developer Certification. These include:

  • Expand your FileMaker developer skill set
  • Stay up-to-date on current FileMaker technologies
  • Increase your credibility (“dev cred”)
  • Promote yourself with the FileMaker Certification logo
  • Preferred listing on the FileMaker website (FBA only)

How do you prepare for the exam?

There is an exam study guide provided on the FileMaker web site. FileMaker recommend “at least 6 months of development experience with the FileMaker Platform before attempting the exam”.

While there is nothing better than hands-on experience with FileMaker products, many people still struggle with what to study and how to study in each of the areas identified. The exam covers areas where you may not have had any practical development experience. So what do you need to know?

Do a Certification Preparation course

uLearnIT is seeking expressions of interest from people to attend a Certification Preparation course. This course is written and presented by David Head. He is a Certified Developer in every version of the FileMaker Platform beginning with version 7.

David has successfully run this course for previous FileMaker versions. Many people attending not only passed the exam, but also recognised benefits in how they approach and develop their FileMaker solutions.

The course does not “teach to the exam”. David covers materials that will be in the exam and also material that will not (but probably could be). He presents material from the point of view of “why is this important to a FileMaker Developer?”. The presentations and exercises will make you question your ideas about FileMaker products. You will think more about how they work and why they behave the way they do.

Example

For example, when a FileMaker script is run with Full Access privileges, does that present any security risk? Can a user get access to parts of the solution that they should not? How do this feature actually work? What Get functions are affected by running a script in this way?

The course is a series of intense study sessions over consecutive days. There is a combination of theory and group exercises. Group discussion should challenge your ideas about how FileMaker works.

You will think about content from the point of view of what is important and what you really need to know. The exercises will give you skills to go and investigate parts of FileMaker in a structured way. It will get you thinking the right way.

Expressions of Interest (EOI) now open

uLearnIT is calling for expressions of interest in attending a Developer Certification Preparation course. This course will not be able to be run in every location. We are looking for locations where there is enough interest to make the courses viable. We will need a minimum of eight (8) participants in any location to schedule a course.

If you express interest in the course, there is no commitment on your part to attend and the expression is not an enrolment. When course locations and dates are confirmed, we will open limited enrolment. People who express interest will be given first priority.

If you are interested in this course, please fill out the EOI survey at:

surveymonkey.com/r/7PTZYJS

If you have any questions, please email us at info@ulearnit.com.au or use the contact form on this web site.

The A-Z of FileMaker: N is for Navigation (part)

FileMaker layouts are composed of parts. Layouts, and therefore layout parts, are used to display data and other objects. Parts can be used to control how data is displayed.

Navigation parts were introduced in FileMaker Pro 14. There are two available for any layout – top and bottom. On screen, these parts display at the top and bottom of the window. They are called navigation parts because they will typically contain buttons and other objects that help the user to navigate the solution and identify the current location.

Adding parts to a layout

The easiest way to add parts to a layout is using Insert > Part… (when in Layout mode). Some parts may be greyed out to indicate that you already have one on the layout (and you can only have one).

Insert > Part…

Removing parts

If you need to remove a part from a layout, click the part tab at the left when in Layout mode. Then press delete on your keyboard. If the part contains objects you will be asked if you are sure (delete the part and all objects in it), otherwise the part will be deleted immediately.

Aren’t navigation parts just a header and footer?

At first glance, navigation parts appear to behave in the same way as header and footer parts. Fields placed in any of these parts will display data from the current record when in Browse mode.

When working in List or Table view, these parts will behave in a very similar way. The top navigation part appears at the top of a window and then the header part below. The bottom navigation part is at the bottom of the window with the footer above. None of the parts move as the user scrolls through a list of records.

Displaying parts in Table view

If you use Table view, you may not see navigation, header and footer parts. You can turn on display of any of these parts for any layout via Layouts > Layout Setup… Then in Views, click the Table View Properties button to access display for these four parts. Not easy to get to is it?

table view properties

When working in Form view and the body part is longer than the window, the header will disappear off the top of the screen when the user scrolls down. Similarly, the footer will only be visible when the user scrolls to the bottom of the body part. If the body part is shorter than the window, the footer will appear immediately after the body part (perhaps halfway up the window).

A difference to note is that the navigation parts will always fill across the entire window. In Form and List views, header and footer parts only extend to the implicit right edge of the layout (set in Layout mode). In Table view all parts fill across the entire window.

Forcing a header or footer to fill across the window

This can be done by setting any object in the part with a right anchor. Interestingly, if this is done in either the header or footer, it will affect both parts.

To print or not to print

A major difference between the part types is that navigation parts do not print – they are intended purely for on screen use. Of course, this also means that navigation parts do not display in Preview mode.

When printing headers and footers, they will appear at the top and bottom of each page. However, unlike in Browse mode, the header will display data from the first record on the page and the footer from the last record on the page.

There also exist title header and title footer parts. When printing, these parts will appear at the top and bottom of the first page (replacing the header and footer).

Zoom locked

Unlike all other parts, navigation parts will not zoom. With any change to the zoom level, navigation parts and their objects will remain at 100%.

Formatting part display

All parts can be styled through the Appearance tab of the Inspector. First click the part tab at the left of the part in Layout mode. Changes can be applied to the fill (none, solid, gradient or image), line and inner shadow.

part formatting

The default style for each part is set according to the theme chosen. All parts share the same set of custom styles. So it is possible to use styles to ensure that your top and bottom navigation parts are exactly the same.

Conclusion – when to use navigation parts

Use navigation parts when you need an on screen area that is fixed to the top or bottom of the window. Use them to present buttons for various actions and information that needs to be constantly available.

The difference between navigation parts and header/footer parts is most evident when working with a long body part and scrolling in Form view. In this instance, it may be useful to use a footer part to contain a button that can only be actioned when the screen has been scrolled to the bottom. For example, if you want to force a user to scroll through terms and conditions (and pretend they read them) to get to an Accept button.

Look at some of popular apps like Facebook and Instagram to see how they are using the app equivalent of fixed navigation parts and a header that scrolls off the top of the screen.

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.

Inside FileMaker 16 Seminars

With the release last week of the new FileMaker 16 platform, we are excited to announce a series of full day seminars in Brisbane, Melbourne and Sydney.

FileMaker 16 banner

Each new release brings some great new features and FileMaker 16 is no exception. But how do you get up to speed quickly what is new and how to implement them in your FileMaker apps? Easy – come along to one of our Inside FileMaker 16 seminars.

In a jam-packed day, you will see why the new features are important and how to implement them in a FileMaker app. We will give you a lot of ideas around how you can make best use of the features. Then we show you specifically how to get them working. And you will see things that are not in the FileMaker marketing materials that could be important to you.

At the end of the day, you will be much better informed about how you can move to FileMaker 16 and about what you can use in the new feature set.

Seminar Details and Bookings

For more details about the seminar (locations, dates and content) and to book your place online, see the Inside FileMaker 16 seminar page.