Recent posts:
Recent replies:

Hi Kevin,
I tried the same steps, but not working, same issue as before . 
My version : Ensemble 2017.1
$ZV : Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2017.1.3 (Build 317_0_18252U) .

Thanks for the response Kevin. Using this, I have modified my code to disable all the "Alerting" settings ( even though, they might not be present in the Ens_Config.Item table, but present in the Host class settings in mgmt portal(green color))

OID is , OID of the Ens_Config.Item table.
Here is my code.
Let me know, if I have to change anything.

UpdateSetting(Oid) public
{
Set sts = 0
Set tStatus = 0
If ($Get(Oid) '="")
{
Set item=##class(Ens.Config.Item).%OpenId(Oid) If $IsObject(item)
{
Set tSC = item.GetStaticSettings(.pList)
If $$$ISOK(tSC)
{
         Do item.PopulateVirtualSettings()
           Set n0 = $O(pList(""),-1)
           Set = item.VirtualSettings.Count()
           For = 1:1:
           {
            Set pList(n0+i) = item.VirtualSettings.GetAt(i)             //Check the group of this setting and we need only the Alerting group settings
            If ($LIST(pList(n0+i),16)="Alerting")
            {
             Set SettingName = $LIST(pList(n0+i),2)
             Set SettingType = $LIST(pList(n0+i),1)
             Set SettingDataType = $LIST(pList(n0+i),8)
            Set tSetting = item.FindSettingByName(SettingName, SettingType)
            //Write SettingName,!
            //ZW pList(n0+i)
            
            //If the Setting DataType is String set as empty, otherwise zero
            Set SettingValue = $Select(SettingDataType="%Library.String":"",1:0)
            
            //If the setting is present in Ens_Config.Item table/Production Host class, set the value alone, otherwise Populate the setting into it.
            If '$IsObject(tSetting) {
Set tSetting = ##class(Ens.Config.Setting).%New()
Set tSetting.Name = SettingName
Set tSetting.Target = SettingType
Set tStatus = tSetting.ValueSet(SettingValue)
If $$$ISERR(tStatus) Quit
Set tStatus = item.Settings.Insert(tSetting)
}
Else {
Set tStatus = tSetting.ValueSet(SettingValue)
}
Set sts = item.%Save()
            
       }        
           }     
     }
}
}
Quit (sts&&tStatus)
}

I could see the reason behind this. 
Whatever setting present in the Production class Xdata block, those only available in the Ens_Config.Item table->Settings column
So the real question now is, How do I Update the settings, which are not present in the Production Class/Ens_Config.Item, but showing as a setting for the Business Host in management Portal through a piece of code.

E.g

Production XData block

 <Item Name="OPR_ALL_SMM_MLA" Category="SMM_ADT,SMM_ORM" ClassName="SJHLIB.Operation.HL7.TCPOperation" PoolSize="1" Enabled="true" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
    <Setting Target="Host" Name="LoggingTarget">OPR_LOG_SOCAL_OPR</Setting>
    <Setting Target="Host" Name="ApplicationName">MLA</Setting>
  </Item>
  
  Ens_Config.Item
  
  *LoggingTargetHostOPR_LOG_SOCAL_OPR ApplicationNameHostMLA

Production XData block

<Item Name="test" Category="" ClassName="EnsLib.HL7.Operation.HTTPOperation" PoolSize="1" Enabled="false" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
    <Setting Target="Adapter" Name="HTTPServer">localhost</Setting>
    <Setting Target="Adapter" Name="HTTPPort">30021</Setting>
    <Setting Target="Adapter" Name="Credentials"></Setting>
    <Setting Target="Adapter" Name="URL"></Setting>
    <Setting Target="Host" Name="ArchiveIO">1</Setting>
    <Setting Target="Host" Name="AlertOnError">1</Setting>
    <Setting Target="Host" Name="InactivityTimeout">10</Setting>
    <Setting Target="Host" Name="QueueCountAlert">10</Setting>
    <Setting Target="Host" Name="QueueWaitAlert">10</Setting>
    <Setting Target="Host" Name="AlertRetryGracePeriod">10</Setting>
    <Setting Target="Host" Name="AlertOnErro">0</Setting>
    <Setting Target="Host" Name="PoolSize">1</Setting>
    <Setting Target="Host" Name="PoolSiz">1</Setting>
  </Item>

Ens_Config.Item

"""HTTPServer Adapterlocalhost" HTTPPort Adapter30021 Credentials Adapter URL Adapter ArchiveIOHost1 AlertOnErrorHost0 InactivityTimeoutHost0 QueueCountAlertHost0 QueueWaitAlertHost0 #AlertRetryGracePeriodHost10 AlertOnErroHost0 PoolSizeHost1 PoolSizHost1

Any help is appreciated.

Followers:
Following:
Global Masters badges:
Purushothaman has no Global Masters badges yet.