Article
Tani Frankel · Mar 29, 2016 2m read

Getting Production Setting's Value

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

 

 

20
3 0 10 1,426
Log in or sign up to continue

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 

$lb("Core","PoolSize",1,1,"",3,"Number of jobs to start for this config item. <br>Default value: <br>0 for Business Processes (i.e. use shared Actor Pool) <br>1 for FIFO message router Business Processes (i.e. use a dedicated job) <br>1 for Business Operations <br>0 for adapterless Business Services <br>1 for others <br>For TCP based Services with JobPerConnection=1, this value is used to limit the number of connection jobs if its value is greater than 1. A value of 0 or 1 places no limit on the number of connection jobs.","%Library.Integer","","0","","","",0,"Pool Size","Additional","Additional Settings","")

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.

Property name_BO As %String(MAXLEN = "");

/// Additional Settings 
Parameter SETTINGS = "name_BO:Basic:selector?context={Ens.ContextSearch/ProductionItems?targets=1&productionName=@productionId}";

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!!

You mean the comment:

if ##class(Ens.Config.Item).NameExists("UT.Client.GPK.Production","RS.Transformation",.id) 
{ 
 set item=##class(Ens.Config.Item).%OpenId(id) write item.PoolSize 
}

But what the input values ​​mean?

  • UT.Client.GPK.Production -> production name ¿?
  • RS.Transformation -> class name ¿?

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

set tSC=##class(EnsPortal.Utils).ItemSettings("Production.Name||Item.Name",.settings,.colNames)

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:

set tSC=##class(EnsPortal.Utils).ItemSettings("My.BP.AA",.settings,.colNames)

To get the settings of My.BP.AA host.

I have not found the function (NameExists) in the documentation

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:

Property name_BO As %String(MAXLEN = "");

/// Additional Settings 
Parameter SETTINGS = "name_BO:Basic:selector?context={Ens.ContextSearch/ProductionItems?targets=1&productionName=@productionId}";

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

set tSC=##class(EnsPortal.Utils).ItemSettings("Production.Name||Item.Name",.settings,.colNames)

OR

set tSC=##class(EnsPortal.Utils).ItemSettings("Production.Name||Item.Name",.settings,.colNames)

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:

<trace value="process.%ConfigName"/>

And here's  the result:

In simple BP, BS and BO you can access current HostName with:

write ..%CinfigName

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

write ##class(Ens.Director).GetItemSettingValue(a,"Host","Name_BO",.status)

You can access all settings of your BP by just calling them directly, in your case:

set a=process."Name_BO"

UPD. Let's continue this discussion in your separate question.