Unlike many other programming languages, FileMaker uses the semicolon as a separator between parameters to a function separator. In many cases this will appear as line endings within code. While FileMaker does not use terminating line endings, it can appear as such. The following guidelines are provided in order to increase the readability and interpretation of FileMaker code.
- Use Hard Tabs: Calculation code should use hard tabs (not spaces) for better readability within the calculation dialog box.
When editing code within the calc dialog box you can use Option-Tab (Mac) or Control-Tab (Win) to insert tabs.
- Maintain spaces between function names and function parameters. This accommodates the cross-platform aspect of double-clicking to highlight function names or parameters on Windows.
Line endings with semicolons: Should not include a space when the line of code is considered "complete". This is done in order to provide a "continuation clue" about the code being read. See the following example. Note that line 8 7 is an If() statement which uses multiple lines. The space after the test parameter of the If () functions indicates that the function has not been "completed" or "closed". Compare this to lines 2-5 where each variable declaration of the Let() function is considered completed.
Code Block linenumbers true
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 // Add "developer" extended privilege to groups which are valid developer groups ~extendedPrivileges = 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]" ) )