Unlike many other programming languages, Claris/FileMaker (by default) uses the semicolon as a separator between parameters within its functions. In many cases this will appear as line endings within code* (especially if you're familiar with other programming languages). While FileMaker does not use terminated line endings in code, it can appear that the semicolon is doing so when using carriage returns after the semicolons within functions.
Functionally broken - or - broken functions?
Essentially, if you're coming from another programming language, then Claris/FileMaker will seem a bit odd because functions are often broken across multiple lines of code.
The following guidelines are provided in order to increase the readability and interpretation of FileMaker code.
Indented calculation code should use hard tabs (not spaces) for better readability within the calculation dialog box.
Inserting tabs in your code
When editing code within the calculation dialog box, you can use Option-Tab (Mac) or Control-Tab (Win) to insert tabs.
Using spaces (not as readable)
Let ( [ ~this = "this"; ~that = "that"; ~function = If ( True ; "success" ; "failure" ) ]; ~this & " & " & ~that & " & the other experienced " & ~function )
Using tabs (more readable)
Let ( [ ~this = "this"; ~that = "that"; ~function = If ( True ; "success" ; // else "failure" ) ]; ~this & " & " & ~that & " & the other experienced " & ~function )
Note, the code displayed on this site converts tab indents to spaces. If you'd like to copy the code inclusive of tabs use the View source feature on each page.
When adding functions within the calculation code editor, whether by auto-complete or double-clicking, the default behavior is for spaces to be used between the function name, parameter names and semicolons. Strive to maintain this consistency.
This accommodates the cross-platform aspect of double-clicking to highlight function names or parameters in both Windows and Mac OS. (e.g. FunctionName<space>(<space>parameter<space>;<space>parameter2<space>)
Don't include a space in front of the semicolon when a line of code is considered functionally "complete". This is done in order to provide a "continuation clue" about the code being read. See the following example. Note that line 11 includes an If() statement which uses multiple lines 11-15. The space after the test parameter of the If () function indicates the function has not been "completed" or "closed". Compare this to lines 3-5 where each variable declaration of the Let() function is considered completed.
Let ( [ // Add names of accounts which are valid developer accounts ~developers = List ( "" ; "" ); ~version = Get ( ApplicationVersion ); ~isGo = PatternCount ( ~version; "Go" ) = True; // Account for foreign versions using comma ~versionNumber = GetAsNumber ( Substitute ( ~version ; "," ; "." ) ); // Add a "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]" ) )
Historically, Claris/FileMaker Pro started with, and only supported, the semicolon as a function parameter delimiter. However, support for using a comma became available in later versions. Some developers may feel more comfortable using a comma within functions.
Choose one and stick with it. For as much as possible, don't start using the comma if an existing system already used the conventional semicolon.
Really? I can use a comma for functions?
Yes, FileMaker functions do support the use of the comma between parameter values. Although, because of FileMaker's history, you won't find this commonly used.
Slow going when choosing the comma
Unfortunately, there is no current setting which allows for the comma to be used as the default parameter separator when using auto-complete or double-clicking of functions. The solution, should you choose to go with it, is creating your own library of expandable snippets.
FilterValues ( Table::field , List ( "this", "that", "other" ) )
is the same as
FilterValues ( Table::field ; List ( "this" ; "that" ; "other" ) )
Notice, if you were to use the comma, it would be suggested that you not follow white space suggestions as it would read more naturally directly after each parameter