Dictionary.KeysWithPrefix
-------------------------

Returns list with all keys matching prefix.

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

MBS( "Dictionary.KeysWithPrefix"; DictionaryRef; Prefix ) 

**MBS**( **"Dictionary.KeysWithPrefix";** /\* Returns list with all keys matching prefix. \*/  
**$DictionaryRef**; /\* The reference number to the dictionary.e.g. $dic \*/   
**$Prefix**) /\* The prefix texte.g. "JS." \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| DictionaryRef | The reference number to the dictionary. | $dic |
| Prefix | The prefix text | "JS." |

### Result

Returns list or error.

### Description

Returns list with all keys matching prefix.  
The order is random and defined by how the dictionary internally stores values.  
See also [Dictionary.Keys](DictionaryKeys.md).  
  
The postfix and prefix keys functions allows you to organize things in the dictionaries with e.g. dot notation. You may have entries like "person.123.firstname" and "person.123.lastname" and by using Dictionary.KeysWithPrefix you can look for "person.123." to find all keys starting with this prefix.  
### Examples

Try it:

 Let(\[  
// create a dicitonary  
dic = MBS ( "[Dictionary.Create](DictionaryCreate.md)");  
// fill in some values:  
t = MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; dic; "person.123 .firstname"; "John" );  
t = MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; dic; "person.123 .lastname"; "Miller" );  
t = MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; dic; "person.456 .firstname"; "Tom" );  
t = MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; dic; "person.456 .lastname"; "Smith" );  
// and query keys:  
r = MBS ( "Dictionary.KeysWithPrefix"; dic; "person.123 ." )  
\]; r)  
<small>  
Example result:   
person.123.lastname  
person.123.firstname</small>### See also

- [Dictionary.Create](DictionaryCreate.md)
- [Dictionary.Keys](DictionaryKeys.md)
- [Dictionary.KeysWithPostfix](DictionaryKeysWithPostfix.md)
- [Dictionary.SetValueForKey](DictionarySetValueForKey.md)

### Release notes

- **Version 11.4**
    - Added [Dictionary.KeysWithPostfix](https://www.mbsplugins.eu/DictionaryKeysWithPostfix.shtml) and [Dictionary.KeysWithPrefix](https://www.mbsplugins.eu/DictionaryKeysWithPrefix.shtml) functions.

### Blog Entries

- [New in MBS FileMaker Plugin 11.4](https://www.mbsplugins.de/archive/2021-09-15/New_in_MBS_FileMaker_Plugin_11/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.4pr1](https://www.mbsplugins.de/archive/2021-08-02/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th July 2021 , last changed 19th July 2021

  
[Dictionary.KeysWithPostfix](DictionaryKeysWithPostfix.md) - [Dictionary.List](DictionaryList.md)

[HTML Version](DictionaryKeysWithPrefix.shtml)