Give Users Feedback with Merge Variables

  • -

Give Users Feedback with Merge Variables

Much of what happens behind the scenes of your scripts is, and should be, invisible to your users. But there are times when you need to give feedback about what’s happening. If a script can’t process an invoice, or is finished marking a found set of records, it’s common to use a Show Custom Dialog script step to tell users what they need to know. But there’s a problem with this step—users have to stop what they’re doing and click OK to make the dialog box go away. That violates at least one rules for creating good user experience: Don’t interrupt your users.

Fortunately FileMaker gives you other ways to give users dynamic information without using a pesky dialog box. You can set your message into a merge variable with an install timer script set, and then clear it back out again with a second one. This process is so useful that we include a pair of scripts for this purpose in every database we design.

Here are the steps you can use to set a message:

 

It’s a good idea to give users audio AND visual feedback, so the script starts with a beep step to get their attention. Then it parses out a message that you send to the script as a parameter. If you’re using the method described in the link above, your message needs a name and value pair, separated by an equals sign. Use this syntax:

message = Email Sent

And to make sure users don’t have to hunt all over their interface to read the message, put the merge variable in the same spot on every layout. This should be such a integrated part of your design routine that that you plan for it from the beginning of a project. Figure out where to put the merge variable, and then format it with whatever red color you’ve chosen for the solution to give another type of feedback that says: This message is important.

So this short little script makes a noise, shows a brief message, and then does its own housekeeping so the user doesn’t have to do anything to make the message go away again.

Here’s the script you can use to clean up afterwards:

 


  • -

Creating Custom Functions

When we provide instructions for creating a custom function, we will specifically provide any Parameters which need to be defined, and also provide the code for the function.

The code will be indicated with the following beginning/ending indicators:

———–BEGIN CODE—————————

The actual code will be here. Do not copy the “Begin Code” and “End Code” lines, but do copy everything between them.

———–END CODE—————————

To create the Custom Function, select File—> Manage—>Customer Functions.

 

The Custom Function dialog box appears. Click “New.”

 

In the Edit Custom Function dialog box, enter the Function Name in the top left field.
In the Function Parameters field, enter each parameter separately and click the “+” button to add it to the list.
In the large field that encompasses the bottom half of the dialog box, paste the code we have provided.
Be sure to indicate whether the function should be available to “All accounts” or “Only accounts assigned full access privileges.”

 

Click OK to close all dialog boxes.