BindKey(Key: String; [CanCreate: Boolean = false]): ISysSettingsKey;
Key. Element key in the settings file.
CanCreate. It indicates whether the element is created if it is missing in the current settings file. Available values:
True. Create an element.
False. Do not create an element (default value).
The BindKey method returns parameters of the specified element with settings.
Key of the Key element is formed from the names of all its parent elements separated with the \\ character. If the @ character is situated before the first value in the key, the value itself is taken as value of the Name attribute for the Key element.
If the CanCreate parameter is set to True, and the element with the Key key is missing, an exception is thrown.
Executing the example requires the settings.xml file. This file contains all sections with BI server settings filled.
Add a link to the Xml system assembly.
Sub UserProc;
Var
Settings: ISysSettings;
Node: ISysSettingsKey;
XmlNode: IXmlDomElement;
Lock: Object;
Begin
Settings := New SysSettings.Create;
Node := Settings.Root;
XmlNode := Node.Element As IXmlDomElement;
//Get parameters of the <Root> element/<Key Name="PP">/<BIS>/<Key Name="System">/<Pool>
Node := Node.BindKey("@PP\\BIS", True);
Node := Node.BindKey("@System\\Pool", True);
XmlNode := Node.Element As IXmlDomElement;
//Change value
XmlNode.setAttribute("MaxConnections", "10");
XmlNode.setAttribute("UserMaxConnections", "2");
//Lock before saving
Lock := Settings.CriticalLock;
Try
Settings.Commit;
Finally
Dispose Lock;
End Try;
End Sub UserProc;
After executing the example, value of the UserMaxConnections parameter is changed in the file with BI server settings. If parameters are missing, they are created.
See also: