Question:
How can I get a value of a setting of a Production item programmatically?
Answer:
You can use one of the API methods of the Ens.Director class, for example:
Ens.Director:GetItemSettingValue()
For example –
In the Production Demo.Workflow.Production the item (Business Operation) 'Demo-Development' has an 'Auto Create Role' setting:
Clicking on the Settings Defaults button you can see this is a 'Host' setting:
And you can access the value using this call for example:
ENSDEMO>write ##class(Ens.Director).GetItemSettingValue("Demo-Development","Host","AutoCreateRole",.status)
1
Note the first argument simply includes the configuration item name 'Demo-Development', as this is the "current" Production.
You can send in a pair of <Production Name>||<Item Name> and get the value of any item in any Production defined.
For example from the Demo.Loan.FindRateProduction Production's Demo.Loan.FindRateOperation, we can access the 'File Path' or 'Business Partner' values –
Note this time the 'File Path' setting is an "Adapter" one and not a "Host" one.
You can get their values using:
ENSDEMO>write ##class(Ens.Director).GetItemSettingValue("Demo.Loan.FindRateProduction||Demo.Loan.FindRateFileService","Adapter","FilePath",.status)
C:\Practice\loan\in
ENSDEMO>write ##class(Ens.Director).GetItemSettingValue("Demo.Loan.FindRateProduction||Demo.Loan.FindRateFileService","Host","BusinessPartner",.status)
LoanTech Corporation
Hello.
How can I get/set pool size value for a Production item programmatically? I can't find it in a "Settings Defaults" list.
There are some ways to retrieve this value
set tSC=##class(EnsPortal.Utils).ItemSettings("Production.Name||Item.Name",.settings,.colNames)
in this case you can find something like here
Or just open this item, and get this property directly
if ##class(Ens.Config.Item).NameExists("UT.Client.GPK.Production","RS.Transformation",.id) { set item=##class(Ens.Config.Item).%OpenId(id) write item.PoolSize }
Hello,
I need to access the value of a setting I created (ex: name_BO) within the logic of my BP.
But the name of the class is common and the production item will change its name.
Example:
Class name: My.BP.Common
Items in the production:
Item 1: My.BP.AA
Item 2: My.BP.BB
Where My.BP.AA and My.BP.BB are My.BP.Common class but have a setting value (name_BO) different.
I need that in the logic of my My.BP.Common get the value of "name_BO"
Can you help me?
Thanks!!
Check the answer by @Dmitry Maslennikov, it seems to do precisely what you need.
You mean the comment:
But what the input values mean?
I have not found the function (NameExists) in the documentation
http://docs.intersystems.com/latest/csp/docbook/%25CSP.Documatic.cls?PAG...
Thanks again!
You need to use
Where ProductionName is Production class. If ProductionName is not given, then the currently running or last run Production will be used. Item.Name is config name, not class. In your case you can call:
To get the settings of My.BP.AA host.
Note, that the index "Name" is defined in this class. <Index>Exists is just an automatically generated method that returns a boolean (Passed index value exists). You can read more about autogenerated methods here.
I think I'm not fully understanding...
The logic is in the class "My.BP.Common"
Therefore, that class does not know the name of the item in production, because those items that use the class "My.BP.Common" will be created later.
For this reason a new parameter has been created in the basic configurations of the BP, using:
I want to obtain the value of this new parameter and use it in the class "My.BP.Common", regardless of the name i have in the production.
Is this possible?
Using
OR
I need to know the name in production
So you want to know the name of a current host from inside of it?
Business host has a %ConfigName property which you can access.
For example in BPL process you can trace the HostName like this:
And here's the result:
In simple BP, BS and BO you can access current HostName with:
That said, why do you need to get the name of a current host from inside of it?
If I get the current host name from inside of it, then I can use this name to acces of the value of setting
set a = process.%ConfigName
You can access all settings of your BP by just calling them directly, in your case:
UPD. Let's continue this discussion in your separate question.