Goodies 37: Format button

We got a format button labeled with "ƒ" for the calculation dialog in FileMaker on macOS.

We parse the formula, detect which brackets belong together and then output the formula with additional whitespacing.

Let's start with a formula we found in our documentation:

You see the calculation has some spaces before and after the equal signs, but not much indention. Pressing the ƒ button on the bottom right toolbar, we get this output currently:

As you see we indent, add whitespace around operators and break up lines based on their length to show parameters. This is the first version and we have some rules on this, but may fine tune them in the next release to find a balanced formatting that most users are fine to use regularly.

Please try in our 13.5 version and please report problems you see. The toolbar appears in the dialog if you either enabled it with the SyntaxColoring.SetCustomFunctionToolsEnabled function or by the checkbox in the preferences dialog.

New in v14.1: You can hold down the option key when clicking the format button to get compact representation of the calculation. That helps to keep it below the 30000 character limit. If needed you can always reformat it in the more readable format. The SyntaxColoring.FormatCalculation function can be used to format calculation in your databases stored in fields.


Shortcuts for align 37 Copy calculation