Plug-ins

 <  Day Day Up  >  

Plug-ins extend FileMaker Pro's capabilities and are quite varied. Their offerings range from charting functionality, OS-level file manipulation, bar code readers, scientific math functions, credit card authentication, help systems, telephony, and more.

NOTE

We encourage you to visit http://www.filemaker.com/plugins/index.html to explore the full breadth of plug-ins.


We won't describe specific plug-ins here; a wide range of professionally supported plug-ins are available, many of which we use frequently in our consulting practice, but one could write an entire book on that topic alone. For the purposes here, we cover briefly the concepts you need to keep in mind for all plug-ins.

Plug-ins are written and compiled in accordance with FileMaker Pro's plug-in API. They're not something many FileMaker developers will ever need to create, and you generally do not have access to the code from which they're built.

If you want to delve into writing your own plug-ins, you need to be an expert in either the C or C++ languages. (We don't recommend a FileMaker plug-in as your first C++ project!) You also need a development environment, such as CodeWarrior for the Mac or Visual Studio for Windows, and the plug-in API documentation and example files that ship with FileMaker Developer. Plug-ins are platform specific, so if you want your plug-in to work on both Mac and Windows, you need to do at least some re-engineering to get your code to compile and run correctly on both Mac and Windows.

As in all third-party software products, we recommend you get to know a given plug-in well and test it along with the rest of your solution before deploying. Another obvious consideration is cost: Some of your clients might benefit from utilizing a plug-in, but remember that this is third-party software and many require purchasing licenses.

Understanding Plug-ins

Plug-ins work by adding external functions to your calculation functions list. Generally, but not always, they take a single text parameter. The result of the plug-in is then delivered in the form of a calculation result.

Here's the general approach:

 

 Set Field [table::fieldname; External ("Plug-in_Function"; "Text_Parameter")] 

In the case of FileMaker's example plug-in, an actual external call looks like this:

 

 XMpl_Add( numberInput1; numberInput2 ) 

If you use this plug-in function, it returns two numbers added together.

The plug-in function is a string specific to the plug-in with which you're working. Its syntax is governed by the plug-in, and (if it followed proper FileMaker, Inc., conventions) includes the name of the plug-in as well. In this case, XMpl_ is the prefix FileMaker chose for its example plug-in. Likewise the expected parameters passed as text vary widely from none to complex data arrays. FileMaker Pro 7's new data storage limit of 2GB per field means that we could be facing some quite complex programming within the realm of a single text field. One of our favorite charting plug-ins requires that a complex array of information be passed to both format and then populate the charts it returns.

When called, the results of a plug-in are returned as a calculation result, but often some other action may be performed as well. For example, a dialog may appear. Often the calculation field simply serves as a means for passing error conditions.

For example, a plug-in might copy an image file from one directory to another. Or it might display a dialog of some kind. Or it might create a chart image and place it on your clipboard. The possibilities are nearly endless and we recommend, again, exploring available plug-ins to understand specific cases.

Using FileMaker's Sample Plug-in

FileMaker Developer includes a sample plug-in, including the C++ library and code necessary for building it. It offers some basic functions that should get you thinking about what plug-ins are capable of.

  • XMpl_Add ” Adds two numbers together. Totally superfluous when you'd always use a calculation to do so, but serves as the most basic example of a plug-in function.

  • XMpl_Append ” Appends the contents of one text field to another. You can continue to add parameters to the function. It simply appends all those that you pass it. Again, redundant with the "&" operator.

  • XMpl_NumToWords ” Converts a number (1111) to words (One Thousand, One Hundred and Eleven).

  • XMpl_StartScript ” Initiates a script as specified by filename and script name.

  • XMpl_UserFormatNumber ” Reformats a number based on user preference. The plug-in's default is a standard (111) 222-3333 North American phone number.

The sections that follow discuss the process of installing and configuring plug-ins in FileMaker.

Installing Plug-ins

There are two distinct types of plug-ins: server based and client based. Deployment is consistent between the two: To enable a plug-in, it needs to be placed in the Extensions folder with the FileMaker application folder for each client, regardless of whether or not it is a server- or client-based plug-in. In addition to each client, server-based plug-ins need to be deployed to the Extensions folder on the server as well. (This is true for both Windows and Mac OS X platforms.)

graphics/troubleshooting_icon.jpg

If your plug-in is not responding, refer to "Plug-in Not Responding or Not Installing" in the Troubleshooting section at the end of this chapter.


Deploying Plug-ins via FileMaker Server

FileMaker Server offers auto-update functionality that copies a plug-in from the server machine onto a client computer when a requisite plug-in is either out of date or missing altogether on the client. This saves a great number of headaches and makes it possible to seamlessly fold a plug-in into a workgroup solution.

The functions that manage auto-update are called by scripts and require, ironically, that the Auto-Update plug-in be installed and enabled on all client computers. (Fortunately it is installed and enabled by default with FileMaker Pro and FileMaker Developer.)

For a full discussion of using plug-ins with FileMaker Server, see "Automatically Updating Plug-ins," p. 760 .


Configuring and Enabling Plug-ins

To enable a particular plug-in, visit the Preferences dialog within your FileMaker Pro (or Developer) application. Notice that to use a given plug-in you need to explicitly enable it (by marking its respective check box), as shown in Figure 26.6.

Figure 26.6. Plug-ins are enabled and configured via the Preferences dialog.

graphics/26fig06.gif


Notice also that your Auto Update plug-in is enabled in this list as well. It is here that you can find all the plug-ins available for a given client.

Some plug-ins offer configuration choices (see Figure 26.7). Every plug-in is different; here we're using the example plug-in that ships with FileMaker Developer, FM.

Figure 26.7. FileMaker's Example plug-in gives users the option to specify a number format for one of its functions in its configuration attributes.

graphics/26fig07.gif


If you've just enabled or installed a plug-in, you'll need to close and restart your FileMaker Pro client to gain access to its external functions.

 <  Day Day Up  >  


QUE CORPORATION - Using Filemaker pro X
QUE CORPORATION - Using Filemaker pro X
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 494

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net