SyntaxColoring.FormatCalculation
--------------------------------

Reformats the calculation text.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [SyntaxColoring](component_SyntaxColoring.md) | [14.1](newinversion141.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "SyntaxColoring.FormatCalculation"; Calculation { ; Flags } ) 

**MBS**( **"SyntaxColoring.FormatCalculation";** /\* Reformats the calculation text. \*/  
**$Calculation**; /\* The calculation text. \*/   
**$Flags**) /\* Optional; Pass 1 for compact output.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Calculation | The calculation text. |  |  |
| Flags | Pass 1 for compact output. | 0 | Optional |

### Result

Returns text or error.

### Description

Reformats the calculation text.  
Takes the text of a calculation, parses it and then outputs it with indentation and whitespace to make sure it looks nice.  
  
See also [SyntaxColoring.Format](SyntaxColoringFormat.md) to apply coloring rules.  
### Examples

Format calculation:

 MBS ( "SyntaxColoring.FormatCalculation"; "1+2" )  
<small>  
Example result: "1 + 2"</small>Format another one:

 MBS ( "SyntaxColoring.FormatCalculation"; "5+6+cos($test )" )  
<small>  
Example result: 5 + 6 + cos( $test )</small>### See also

- [SyntaxColoring.Format](SyntaxColoringFormat.md)

### Release notes

- **Version 14.1**
    - Added [SyntaxColoring.FormatCalculation](https://www.mbsplugins.eu/SyntaxColoringFormatCalculation.shtml) function.

### Example Databases

- [Utility functions/Evaluate](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Utility%20functions/Evaluate.shtml#4ScriptAnchor_)
- [Utility functions/FileMaker Custom Functions via Dictionary](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Utility%20functions/FileMaker%20Custom%20Functions%20via%20Dictionary.shtml#8ScriptAnchor_)
- [Utility functions/FileMaker Custom Functions](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Utility%20functions/FileMaker%20Custom%20Functions.shtml#8ScriptAnchor_)
- [Utility functions/Formula Formatting](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Utility%20functions/Formula%20Formatting.shtml#1ScriptAnchor_)

### Blog Entries

- [Goodies 37: Format button](https://www.monkeybreadsoftware.com/filemaker/SyntaxColoring/37-Formatbutton.shtml)
- [New in MBS FileMaker Plugin 14.1](https://www.mbsplugins.de/archive/2024-03-19/New_in_MBS_FileMaker_Plugin_14/monkeybreadsoftware_blog_filemaker)
- [Neues MBS Plugin 14.1 für Claris FileMaker](https://www.mbsplugins.de/archive/2024-03-12/Neues_MBS_Plugin_141_für_Clar/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 14.1 for Claris FileMaker](https://www.mbsplugins.de/archive/2024-03-12/MBS_Plugin_141_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS @ FMTraining.TV - New examples for FileMaker MBS Plugin](https://www.mbsplugins.de/archive/2024-03-06/MBS_@_FMTrainingTV_-_New_examp/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 14.1pr4](https://www.mbsplugins.de/archive/2024-02-26/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 14.1pr2](https://www.mbsplugins.de/archive/2024-02-14/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 8th February 2024 , last changed 18th January 2026

  
[SyntaxColoring.Format](SyntaxColoringFormat.md) - [SyntaxColoring.GetAddFindbars](SyntaxColoringGetAddFindbars.md)

[HTML Version](SyntaxColoringFormatCalculation.shtml)