Default value for globaldictionaryvalue(

Global dictionaries are proving to be hugely useful to me. However, it would be useful if the globaldictionaryvalue( function could take an optional third parameter giving a default value to be returned if the supplied key does not exist in the dictionary, just like the optional fifth parameter for lookup(.

It’s possible to get round this by trapping the ‘globaldictionaryvalue( value does not exist’ error, but in some situations it would be more elegant (and maybe quicker?) if a default value could be used and the error thereby avoided.

That’s an interesting suggestion, for now you can use the catcherror( function for this.

catcherror(defaultvalue,globaldictionaryvalue(dictionaryname,key))

There should be no speed penalty incurred by using this technique.

I’m glad you are finding global dictionaries to be useful :slight_smile: They are kind of a specialized tool but they are quite handy when you need them.

Thanks. Yes, catcherror( is a tidy way to do it.