When working on a FileMaker solution, there are many situations where debugging information or feedback is required as part of the development process. This type of information is not suitable for display within the realm of normal application use.

Therefore, it is suggested that various portions of your solution utilize a Developer custom function. At its core, the function can be as simple as Get ( AccountPrivilegeSetName ) = "[Full Access]" and named according to the Custom function naming standards.

However, there may be environments where certain accounts are given access to this type of information. In such an event, watching for specific accounts may be desired. The following custom function will provide for this situation.

Lastest version of this function

The function on this page may not be the latest version. To get the latest version make sure and use the master filemakerstandards code repository.

/**
 * =====================================================
 * Developer ( )
 *		https://github.com/petrowsky/fmpstandards/blob/master/Functions/Developer.fmfn
 * 
 * PARAMETERS:
 *		none
 *
 * RETURNS:
 *		(bool) True or False based on proper   
 *		evaluation
 *
 * DEPENDENCIES:
 *		none
 *
 * NOTES:
 *		Because Filemaker Changed Get ( PrivilegeSetName )
 *		Evaluate () must be used
 *
 * RELEASE:
 *		2011-02-23
 * =====================================================
 * 
 */

Let ( [ 

	~developers = List ( "" ; "" );  // Add names of the accounts which are valid developer accounts
	~version = Get ( ApplicationVersion );
	~isGo = PatternCount ( ~version; "Go" ) = True;
	~versionNumber = GetAsNumber ( Substitute ( ~version ; "," ; "." ) ); // account for foreign versions using comma
	~extendedPrivileges = // Add "developer" extended privilege to groups which are valid developer groups
		If (  ~isGo or ~versionNumber ≥ 11;
			Evaluate ( "Get ( AccountExtendedPrivileges )" );
			/*else*/ Evaluate ( "Get ( ExtendedPrivileges )" )
		)

];

	PatternCount ( ¶& ~developers &¶ ; ¶& Get ( AccountName ) &¶ ) ≥ 1
	or PatternCount ( ¶& ~extendedPrivileges &¶ ; ¶& "developer" &¶ ) ≥ 1
	or
	If ( ~isGo or ~versionNumber ≥ 11;
		Evaluate ( "Get ( AccountPrivilegeSetName )" ) = "[Full Access]";
		/*else*/ Evaluate ( "Get ( PrivilegeSetName )" ) = "[Full Access]"
	)

)

Function parameter was changed in FileMaker 11

The Get ( PrivilegeSetName ) was changed to Get ( AccountPrivilegeSetName ) in FileMaker 11 and higher. This requires the use of an Evaluate() function for proper evaluation.

An example of this, within a script, would look like the following

If [ Developer ]
  Show Custom Dialog ["Debugging info"; Debug ( )]
End If

Note the use of the Debug custom function

  • No labels

4 Comments

  1. I normally use an extension of the same idea, DeveloperModifierKeys, which returns the result of Get ( ActiveModifierKeys ) for all developer users, and False otherwise. This allows developers to get the regular end-user experience during testing, and the ability to show more details only when needed.

    #DEVELOPERS: Hold shift when executing this If [] step to show the debugging info dialog
    If [ DeveloperModifierKeys ]
    	Show Custom Dialog [ Get ( ScriptName ) & " - Debugging Info"; Debug ]
    End If
    

    So developers would only get this dialog when they really need it, and they don't have to be bothered with it when they don't.

    1. Jeremy, are you familiar with Git? I have a repo on github.com and I'm in the process of moving my older methods of function.name (dot notation) to the TitleCase format.

      Git repo of Matt's custom functions [Update 3/22/11: don't use this older repository]

      It would be cool to work with consolidating a cohesive set of functions which can be referenced from this wiki.

      I also started a Git repo of fmstandards where I had my original OmniOutliner doc and a FileMaker file with the standards

      The wiki will output a PDF based on pages, but it's not as pretty as what Omni can output. I figure once we get these things finalized for a release, I would update the Omni file and make a PDF version. Up for learning Git if you don't know it?

  2. Anonymous

    The Developer CF does only work correct on an English version of FileMaker.

    With FileMaker 10 and German language setting you will only treat as "Developer", if you account name is in the list:

    GetAsNumber ( Get ( ApplicationVersion ) ) is in German 1003 and not 10.03, because of the "," instead of "." as seperator.

    karo.