InterfaceFile ( )

Function stats

Average user rating
36
163
9999
Support
FileMaker 7.0 +
Date posted
24 December 2008
Last updated
24 December 2008
Version
Recursive function
No

Author Info
 Fitch

2 functions

Average Rating 4.0

author_avatar



 

Function overview

Prototype

InterfaceFile  (  )


Parameters

No parameters for this function.


Description

Tags:  Dev  

This function is called "InterfaceFile" because it might typically be useful when using the so-called Separation Model of FileMaker development. The function is nothing but a text string. The point of it is in this technique:

In some scripts or calculations we need to reference a file name as a text string (e.g. "Main Menu"). When the file in question is the same as the calc or script, we can avoid hard-coded strings with the Get(FileName) function. If it's a different file, however, we must supply a hard-coded name.

The problem is, if that file name ever changes, we must manually change our references one by one. This is tedious and error-prone. Instead, wherever a hard-coded string is required, reference this custom function instead. That way if you ever need to change the file name (perhaps just for testing purposes), you can do it easily by simply changing the custom function.

Examples

Sample input

InterfaceFile


Sample output

Main Menu

 

Function code

"the name of your file"

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/163

    Prototype: InterfaceFile( )
    Function Author: Fitch (http://www.fmfunctions.com/mid/36)
    Last updated: 24 December 2008
    Version: 1.1

*/
// ===================================

 

Comments

nbm
24 February 2009



Where do you input the function code? I must be missing the obvious.
I have a script that points to a file to open. Can I use this function to refer to a field value and open a different file? Thanks, StephenArpie@NoteBookMaker.com
  General comment
Fitch
25 February 2009



You must have FileMaker Pro Advanced to create or edit custom functions. Once created, these functions can be used (but not edited) in FileMaker Pro. Custom functions are defined under File > Manage > Custom Functions.

As for your second question: the Open File script step requires the file to be defined in your data sources, so no, you couldn't use this function there, nor could use use a field value.

This function is meant to be used in calculations where you would refer to the file name as a text string, e.g. imagine a script step such as:
If[ Get(FileName) = "Pretty Good File" ]

Then you decide to change your file name to "Power File Pro." You'd need to find all the places where you used "Pretty Good File" in script steps or calculations and change them. But if you had instead used:
If[ Get(FileName) = InterfaceFile ]

Then you'd simply change that one CF and that's it.
  General comment

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (31)
Date  (28)
XML  (26)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (12)
Layout Objects  (11)
Filter  (11)
Design  (10)
Array  (7)