Expand/Shrink

dict_name

Definition: string name = dict_name(integer tid=1)
-- or --
integer tid = named_dict(string name)
Description: Retrieve the diagnostic name associated with the dictionary at creation time.
The name of the common/default dictionary(1) is always "1".
The converse is also supported, ie retrieve the (first) tid associated with a given name, or NULL if no such name can be found (case sensitive, so "Name" will not match "name").
pwa/p2js: Supported.
Comments: The name is intended purely for diagnostic purposes, although there is nothing to stop code from using the name to control logic flow depending upon which dictionary it has been passed - eg if the dictionary name is "customers" or "suppliers" then do something different to get an address, since typically suppliers don’t have multiple delivery addresses.

The named_dict() routine can be useful to check whether a dictionary of that name has already been created, or perhaps to grant something a unique-but-generic name, or just to avoid one of those pesky global variables you don’t quite know where to put. Note that, as always, careful locking will be required should multiple threads be attempting to access dictionaries.
Example:
integer tid = new_dict("test")
?dict_name(tid) -- displays "test"
See Also: new_dict