Question
· Aug 28, 2023

Variable as a property value

When creating the db using the Properties array, if I use a literal like "/iris/db/<instance name>/<directoryname>" it's created in the correct directory.

       set Properties("Directory")="/iris/db/InstanceName/DirectoryName"

but when it's executed with a variable, as in the example below,  it gets created in /iris/sys/<instance name>/mgr/

      set directoryPath="/iris/db/InstanceName/DirectoryName"
      set Properties("Directory")=directoryPath

 Is there any reason string literals work and variables do not?

Discussion (5)1
Log in or sign up to continue

If so why then pick default config rather than what is passed as a variable? Here is another case when it will fall back to the default one instead using what is set as a variable:

set Name=$SYSTEM.Util.GetEnviron("RESOURCE_DB_NAME")
set Path=$SYSTEM.Util.GetEnviron("RESOURCE_DB_PATH")
set Properties("Directory")=Path
set Status=##Class(Config.Databases).Create(Name,.Properties)