AddVariable method
The AddVariable method adds a variable to a SetupNode object and assigns a default value.
By default, all SetupNode objects include the standard variables that are installed with Datacap. For more information, see the Standard Variable Reference section in IBM® Knowledge Center for Datacap.
Syntax
- VBScript
oSNO.AddVariable(lpszName as String, lpszValue as String) as Boolean- C#
bool AddVariable(string lpszName, string lpszValue)
Applies to
All node types.
Arguments
- lpszName
- Name of the new variable.
- lpszValue
- Default value (always a string)
Returns
Returns true if successful; returns false if unsuccessful.
C# example
This example gets the SetupNode object for the Invoice document in the APT.XML Setup DCO file and adds a variable NewVar with a default value True:
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
TDCOLib.DCOSetup m_oDCOSetup = m_oDCO.SetupObject();
TDCOLib.DCOSetupNode m_oDCOSetupNode =
m_oDCOSetup.GetNodeByName(1, "Invoice");
m_oDCOSetupNode.AddVariable("NewVar", "True");
The following line is added to the Setup DCO:
<D type="Invoice">
.
.
.
<V n="NewVar">True</V> <!-- New line added -->