Using a calculated value for a property's InitialExpression. Written in Intersystems Cache Object Script.
...class definition
/// Set InitialExpression to any class method returning the calculated value.
/// In this case, I'm returning a string value.
Property BaseDirectoryPath As %String [ InitialExpression = {..GetBaseDirectoryForNamespace()} ];
/// Returns the base directory path to use for whatever cache instance the class is being used in.
ClassMethod GetBaseDirectoryForNamespace() As %String
{
SET vPath = $CASE($Namespace,
"MCCRDA":"/home/mccrda/stage/control/",
"STAGE":"/home/ensemble/stage/control/",
"PROD":"/home/ensemble/prod/control/",
"PROD2":"/home/ensemble2/prod2/control",
:"/home/raczta/stage/control/")
Quit vPath
}