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

cpf files.

All classes from Config package affect one of cpf file (active one by default). But you also need to save and activate modified config file. Dmitry solution does that all by default. Which is fine if you want to add one mapping, but if you want to modify several Config settings it's better to modify them and activate the changes separately. For example here's mapping several packages to %ALL.

#include %syConfig
set namespace = "%ALL"
set namespace = $zcvt(namespace, "U")
for package = "Package1","Package2","Package3" {
    kill p
    set p("Database")=pFrom
    set sc = ##Class(Config.MapPackages).Create(namespace, package,.p,,$$$CPFSave)
}
set sc = ##Class(Config.CPF).Write()
set sc = ##Class(Config.Map).MoveToActive(namespace)
set sc = ##Class(Config.Namespaces).Load(namespace)