Dictionary.ToText
-----------------

Returns text representation of dictionary for data exchange.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Dictionary](component_Dictionary.md) | [6.1](newinversion61.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Dictionary.ToText"; DictionaryRef { ; Column Delimiter; Row Delimiter } ) 

**MBS**( **"Dictionary.ToText";** /\* Returns text representation of dictionary for data exchange. \*/  
**$DictionaryRef**; /\* The reference number to the dictionary.e.g. $dic \*/   
**$Column Delimiter**; /\* Optional; The delimiter between key and value.  
Should not be part of content.  
By default we use tab key. \*/   
**$Row Delimiter**) /\* Optional; The delimiter between rows.  
By default we use return key (char 13) \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| DictionaryRef | The reference number to the dictionary. | $dic |  |
| Column Delimiter | The delimiter between key and value.   Should not be part of content.   By default we use tab key. |  | Optional |
| Row Delimiter | The delimiter between rows.   By default we use return key (char 13) |  | Optional |

### Result

Returns text or error.

### Description

Returns text representation of dictionary for data exchange.  
Containers are just added as text and delimiters inside a text value can cause trouble.  
### Examples

Test exporting dictionaries:

 #   
\#   
\#Create new Dictionary   
\#   
Set Variable \[$param ; Value:MBS ( "[Dictionary.Create](DictionaryCreate.md)" )\]  
\#   
\#Fill in values   
\#   
Set Variable \[$r ; Value:MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; $param ; "text"; Pass Parameters with Dictionary::TextField )\]  
Set Variable \[$r ; Value:MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; $param ; "number"; Pass Parameters with Dictionary::NumberField )\]  
Set Variable \[$r ; Value:MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; $param ; "date"; Pass Parameters with Dictionary::DateField )\]  
Set Variable \[$r ; Value:MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; $param ; "time"; Pass Parameters with Dictionary::TimeField )\]  
Set Variable \[$r ; Value:MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; $param ; "timestamp"; Pass Parameters with Dictionary::TimeStampField )\]  
Set Variable \[$r ; Value:MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; $param ; "container"; Pass Parameters with Dictionary::ContainerField )\]  
\#   
\#Call save xml, json and text   
\#   
Set Variable \[$r ; Value:MBS ( "[Text.WriteTextFile](TextWriteTextFile.md)"; MBS ("[Dictionary.ToXML](DictionaryToXML.md)"; $param ; 1); MBS ( "[Path.AddPathComponent](PathAddPathComponent.md)"; MBS ( "[Folders.UserDesktop](FoldersUserDesktop.md)" ) ; "dictionary.xml"); "UTF8")\]  
Set Variable \[$r ; Value:MBS ( "[Text.WriteTextFile](TextWriteTextFile.md)"; MBS ("Dictionary.ToText"; $param ); MBS ( "[Path.AddPathComponent](PathAddPathComponent.md)"; MBS ( "[Folders.UserDesktop](FoldersUserDesktop.md)" ) ; "dictionary.txt"); "UTF8")\]  
Set Variable \[$r ; Value:MBS ( "[Text.WriteTextFile](TextWriteTextFile.md)"; MBS ("[Dictionary.ToJSON](DictionaryToJSON.md)"; $param ); MBS ( "[Path.AddPathComponent](PathAddPathComponent.md)"; MBS ( "[Folders.UserDesktop](FoldersUserDesktop.md)" ) ; "dictionary.json.txt"); "UTF8")\]  
\#   
\#free memory   
\#   
Set Variable \[$r ; Value:MBS ("[Dictionary.Release](DictionaryRelease.md)"; $param )\]  
### See also

- [Dictionary.Count](DictionaryCount.md)
- [Dictionary.Create](DictionaryCreate.md)
- [Dictionary.Lookup](DictionaryLookup.md)
- [Dictionary.Release](DictionaryRelease.md)
- [Dictionary.SetValueForKey](DictionarySetValueForKey.md)
- [Dictionary.ToJSON](DictionaryToJSON.md)
- [Dictionary.ToXML](DictionaryToXML.md)
- [Folders.UserDesktop](FoldersUserDesktop.md)
- [Path.AddPathComponent](PathAddPathComponent.md)
- [Text.WriteTextFile](TextWriteTextFile.md)

### Blog Entries

- [MBS FileMaker Advent calendar - Door 23 - Dictionary](https://www.mbsplugins.de/archive/2025-12-23/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.1pr3](https://www.mbsplugins.de/archive/2016-02-25/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 25th February 2016 , last changed 9th November 2021

  
[Dictionary.ToMatrix](DictionaryToMatrix.md) - [Dictionary.ToXML](DictionaryToXML.md)

[HTML Version](DictionaryToText.shtml)