Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Dictionary.CreateNamed
Creates a new dictionary with desired key.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Dictionary | 8.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
KeyRef | The desired key reference. | "IDs" | |
Key... | Optional, a key. | Optional | |
Value... | Optional, a value. | Optional |
Result
Returns dictionary reference or error.
Description
Creates a new dictionary with desired key.Dictionaries are hash maps, so lookup is very fast (often faster than search in your FileMaker database). You can use them for storing parameters or lookup tables.
Optionally you can pass keys and values as parameters to this function.
If you looked for associative arrays, you are right here.
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.
Please repeat Key and Value parameters as often as you need.
Examples
Creates new dictionary with reference number "IDs":
MBS("Dictionary.CreateNamed"; "IDs")
Create dictionary, add a function and call it:
# create environment
Set Variable [ $CF ; Value: MBS("Dictionary.CreateNamed"; "test" ) ]
#
# Register one function. Replacing older one with same name
Set Variable [ $FunctionName ; Value: "Greet" ]
Set Variable [ $Body ; Value: "/// Name¶¶\"Welcome \" & Name & \"!\"" ]
Set Variable [ $r ; Value: MBS( "Dictionary.SetValueForKey"; "test"; $FunctionName; $Body) ]
#
# now run it
Set Variable [ $r ; Value: MBS("FM.CF"; "test"; "Greet"; "Peter") ]
Show Custom Dialog [ "Result" ; $r ]
#
# cleanup
Set Variable [ $r ; Value: MBS("Dictionary.Release"; "test") ]
Build a dictionary with given Keys and Values:
MBS("Dictionary.CreateNamed"; "MyName"; "FirstName"; $FirstName; "LastName"; $LastName; "City"; $City; "Phone"; $Phone; "Email"; $Email)
See also
Release notes
- Version 8.1
- Added Dictionary.CreateNamed function.
Example Databases
Blog Entries
This function checks for a license.
Created 27th February 2018, last changed 16th December 2023
