c2763760 - Datacap Objects (DCO) API Guide
c2763760 - Datacap Objects (DCO) API Guide
Version 9 Release 0
SC27-6376-00
IBM Datacap
Version 9 Release 0
SC27-6376-00
Note
Before using this information and the product it supports, read the information in “Notices” on page 93.
This edition applies to Version 8 Release 1 of Datacap (product number 5725-C15) and to all subsequent releases
and modifications until otherwise indicated in new editions.
© Copyright IBM Corporation 2014.
US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract
with IBM Corp.
Contents
ibm.com and related resources. . . . . v IsValid method . . . . . . . . . . . 37
How to send your comments . . . . . . . . . v MoveChild method . . . . . . . . . . 37
Contacting IBM . . . . . . . . . . . . . vi MoveIn method . . . . . . . . . . . 38
NumOfChildren method . . . . . . . . 39
Datacap object API . . . . . . . . . . 1 NumOfVars method . . . . . . . . . 39
ObjectType method . . . . . . . . . . 40
Relationship between runtime batch and document
Parent . . . . . . . . . . . . . . 41
hierarchy . . . . . . . . . . . . . . . 2
Read method . . . . . . . . . . . . 41
Creating a document hierarchy with Datacap object
ReadSetup method . . . . . . . . . . 42
APIs . . . . . . . . . . . . . . . . . 3
SetPosition method . . . . . . . . . . 43
DCO APIs . . . . . . . . . . . . . . . 4
SetupNode method . . . . . . . . . . 44
DCO properties . . . . . . . . . . . . 6
SetupObject method . . . . . . . . . 45
AltConfidenceString property. . . . . . . 6
set_AltConfidenceString . . . . . . . . 45
AltText property . . . . . . . . . . . 7
set_AltText method . . . . . . . . . . 46
CharConfidence property . . . . . . . . 8
set_CharConfidence method . . . . . . . 47
CharValue property . . . . . . . . . . 8
set_CharValue method. . . . . . . . . 48
ConfidenceString property . . . . . . . . 9
set_OMRValue . . . . . . . . . . . 49
ID property . . . . . . . . . . . . 10
set_Variable method . . . . . . . . . 49
ImageName property . . . . . . . . . 10
Write method. . . . . . . . . . . . 50
Status property . . . . . . . . . . . 11
WriteSetup method . . . . . . . . . . 51
Text property . . . . . . . . . . . . 11
DCOSetup API . . . . . . . . . . . . . 51
Type property . . . . . . . . . . . 12
DCOSetup properties . . . . . . . . . . 54
Variable property . . . . . . . . . . 12
DictionaryName property . . . . . . . 54
XML property . . . . . . . . . . . 13
Path property. . . . . . . . . . . . 54
DCO methods . . . . . . . . . . . . 14
Value property . . . . . . . . . . . 55
AddChild method . . . . . . . . . . 14
Word property . . . . . . . . . . . 55
AddValue method . . . . . . . . . . 15
DCOSetup methods . . . . . . . . . . 56
AddVariable method . . . . . . . . . 16
AddNode method . . . . . . . . . . 56
AddVariableFloat method . . . . . . . 17
DeleteNode method . . . . . . . . . 57
AddVariableInt method . . . . . . . . 17
DeleteNodeByName Method . . . . . . 58
AddVariableString method . . . . . . . 18
get_DictionaryName method . . . . . . 59
CheckIntegrity method . . . . . . . . 18
get_Value method . . . . . . . . . . 59
Clear method . . . . . . . . . . . . 19
get_Word method . . . . . . . . . . 60
CreateDocuments method . . . . . . . 20
GetNode method . . . . . . . . . . 60
CreateFields method . . . . . . . . . 21
GetNodeByName method . . . . . . . 61
DeleteChild method . . . . . . . . . 21
NumOfDictionaries method . . . . . . . 62
DeleteValue method . . . . . . . . . 22
NumOfNodes method . . . . . . . . . 62
DeleteVariable method. . . . . . . . . 23
NumOfWords . . . . . . . . . . . 63
FindChild method . . . . . . . . . . 23
ReadLock . . . . . . . . . . . . . 64
FindChildIndex method . . . . . . . . 24
ReadSetup . . . . . . . . . . . . . 64
FindRouteChild method . . . . . . . . 25
set_DictionaryName method. . . . . . . 64
FindVariable method . . . . . . . . . 25
set_Value method . . . . . . . . . . 65
get_AltConfidenceString method . . . . . 26
set_Word method . . . . . . . . . . 66
get_AltText method. . . . . . . . . . 27
ShowSetupDialog . . . . . . . . . . 66
get_CharConfidence method. . . . . . . 28
UnlockIt . . . . . . . . . . . . . 66
get_CharValue method . . . . . . . . 29
WriteSetup method . . . . . . . . . . 67
get_OMRValue method . . . . . . . . 30
DCOSetupNode APIs . . . . . . . . . . . 67
get_Variable method . . . . . . . . . 30
DCOSetupNode properties . . . . . . . . 68
GetChild method . . . . . . . . . . 31
Name property . . . . . . . . . . . 68
GetLastError method . . . . . . . . . 32
ObjectType property . . . . . . . . . 69
GetPosition method . . . . . . . . . 32
RuleChildName . . . . . . . . . . . 70
GetRoute method . . . . . . . . . . 33
RuleMaxNum . . . . . . . . . . . 70
GetVariableName method . . . . . . . 34
RuleMinNum. . . . . . . . . . . . 71
GetVariableValue method . . . . . . . . 35
RuleObjectType . . . . . . . . . . . 72
IsError method . . . . . . . . . . . 36
RulePosition . . . . . . . . . . . . 72
IsRoute method . . . . . . . . . . . 36
Variable . . . . . . . . . . . . . 73
Product support is available on the Web. Click Support from the product Web site
at:
Datacap
http://www.ibm.com/support/entry/portal/Software/
Enterprise_Content_Management/Datacap_Taskmaster_Capture
Knowledge Center
You can view the product documentation on ibm.com. See Knowledge Center at
http://www.ibm.com/support/knowledgecenter/SSZRWV_9.0.0/.
PDF publications
You can view the PDF files online using the Adobe Acrobat Reader for your
operating system. If you do not have the Acrobat Reader installed, you can
download it from the Adobe Web site at http://www.adobe.com.
Tell us how you feel about the value of quality content by taking the Importance of
High Quality Technical Information survey at the following link:
http://www.ibm.com/survey/oid/wsb.dll/s/ag2c1. If you want to help IBM
make this product easier to install and use, take the Consumability Survey at the
following link: http://www.ibm.com/software/data/info/consumability-survey/.
Contacting IBM
To contact IBM customer service in the United States or Canada, call
1-800-IBM-SERV (1-800-426-7378).
To learn about available service options, call one of the following numbers:
v In the United States: 1-888-426-4343
v In Canada: 1-800-465-9600
For more information about how to contact IBM, see the Contact IBM Web site at
http://www.ibm.com/contact/us/.
Datacap contains three separate classes or APIs that you can use to complete
actions on different parts of a Datacap object (DCO), which can be a batch,
document, page, field, or character. You use the three sets of Datacap API to
modify the document hierarchy (setup DCO) and the runtime batch hierarchy
(runtime DCO).
Datacap requires an XML file to process a batch. When you use Datacap Studio to
create an application, Datacap saves the setup DCO as an XML file, for example,
C:\Datacap\application name\dco_application name\application name.xml.
Similarly, if you create a document hierarchy outside of Datacap Studio, you use
an API to save the setup DCO as an XML file. Each Datacap object is represented
as a node in the XML file. The setup DCO defines the expected structure of a
batch, including valid documents, pages in documents, the fields on each page,
and other predefined information.
Datacap creates the runtime DCO when a workflow is started. When a task
completes, Datacap writes the batch to a batch folder, for example,
C:\Datacap\APT\batches\batch number. The runtime information comprises a root
file that is named after the completed task, for example, C:\Datacap\APT\batches\
batch number\Verify.xml and defines the documents and pages in the batch.
Datacap also writes a data file for each page, for example, C:\Datacap\APT\
batches\batch number\tm000001.xml. The runtime DCO indicates the current
composition of the batch, including documents, pages, fields, and characters.
The three sets of APIs are DCO, DCOSetup, and DCOSetupNode. You can use the
APIs to search or browse through a DCO object, starting from the root node
(batch) to a child node, which includes documents, pages, fields, and characters.
Using the APIs, you can find and select a child node, and modify or populate a
value. You use the DCO APIs with a runtime DCO, the DCOSetup APIs with the
setup DCO, and the DCOSetupNode APIs with individual nodes in the setup
DCO. The following tasks represent a sample of how you can use some of the
APIs:
v Create a document hierarchy
v Modify a batch by creating documents, reorganizing pages, or deleting
documents
v Determine the page types that contain confidential information and, with the
implementation of custom verification panels, display only those pages to an
operator who has appropriate security clearance
v Create, modify, or populate fields and characters
v Access and modify a dictionary that can be used to present a list of valid field
values to an operator during a verification task
v Use XML files to load a batch, or save a batch to a disk
DCO object
( Batch )
DCO object DCO object DCO object DCO object DCO Setup object
( TYPE=Other ) ( TYPE=Other ) ( TYPE=Other ) ( TYPE=Other ) ( Batch )
Pages
Document 1 Document 2
Document hierarchy
Datacap identifies each page type by referencing the types that are defined in the
document hierarchy, and assigns the appropriate TYPE attribute to each page object.
For example, the four pages in the runtime batch hierarchy are identified as P1, P2,
P3, and P4, as shown in the following diagram:
DCO object
( Batch )
DCO object DCO object DCO object DCO object DCO Setup object
( TYPE=P1 ) ( TYPE=P2) ( TYPE=P3 ) ( TYPE=P4 ) ( Batch )
Pages
Document 1 Document 2
Document hierarchy
DCO object
( Batch )
Documents
DCO object DCO object DCO Setup object
( Type=D1 ) ( Type=D2 ) ( Batch )
This task also assumes that you successfully exported a batch of documents from a
database to an XML file.
Because the use of Datacap object APIs is limited to runtime batches and document
hierarchies, the task does not include steps for data recognition and initial
calculation of confidence levels.
Tip: You can similarly add pages, fields, or characters by setting the nType
value to 2 (for pages), 3 (for fields), or 4 (for characters).
4. Use the AddRule method to specify the structure of a document. This step gets
the SetupNode object for the NewNode document in the Setup DCO. The step
then adds a rule that requires one instance of the page NewPage to exist for the
document structure to be valid. If a page node for NewPage does not exist, the
method creates NewPage automatically.
TDCOLib.DCOSetup m_oDCOSetup = m_oDCO.SetupObject();
TDCOLib.DCOSetupNode m_oDCOSetupNode =
m_oDCOSetup.GetNodeByName(1, "NewNode");
m_oDCOSetupNode.AddRule(2, "NewPage", 0, 1, 1);
After the execution of the code, the following line is added to the Setup DCO
beneath the NewNode document type.
<D type="NewNode">
.
.
.
<P type="NewPage" pos="0" min="1" max="1"/> <!-- New line added -->
Additionally, if NewPage does not exist, the following page node is created in
the Setup DCO:
<P type="NewPage">
<V n="ID">0</V>
<V n="TYPE">Page</V>
<V n="STATUS">0</V>
<V n="IMAGEFILE"></V>
<V n="DATAFILE"></V>
<V n="TEMPLATE IMAGE"></V>
<V n="MIN_TYPES">0</V>
<V n="MAX_TYPES">0</V>
</P>
5. Use the Read method, Write method, and the XML property to export the
document hierarchy to an external location, which can be a content repository,
a database, or a web server. This example exports the document hierarchy to a
temporary location on a local server:
m_oDCO.Read("C:\\C:\\Datacap\\NEW\\dco_NEW\\NEW.XML");
strDCOXml = m_oDCO.XML;
m_oDCO.Write ("c:\\temp_location\\new_application.xml")
The Read method stores the document hierarchy in a setup object. The XML
property assigns the XML file to a variable, and the Write method writes the
document hierarchy (setup DCO) to a new location.
DCO APIs
The DCO APIs include properties and methods that you can use to modify the
runtime batch hierarchy, which is also known as the runtime DCO. For example,
when your business requirements change, you can use these APIs to add or
remove documents and pages, or change the names or values of object types.
When you create a runtime DCO object (m_oDCO in this example), a corresponding
DCOSetup object is created automatically. The DCOSetup object is a child of the
DCO object.
TDCOLib.IDCO m_oDCO = new TDCOLib.DCOClass();
//Creating a runtime DCO object
DCOSetup object
( Batch )
Because the DCOSetup object is empty, you need to populate the DCOSetup object
from the Setup DCO file of the application.
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
//Reading a Setup DCO file
DCO object
( Batch )
DCOSetup object
( Batch )
Document 1 Document 2
You use the DCO API properties to change the names of object types, and you can
use methods to add or remove child objects.
DCO properties
You can use DCO properties to access or modify the names and values of DCO
objects, including documents, pages, fields, and characters. You can also use DCO
properties to modify metadata, which includes confidence levels, IDs, types,
statuses, and variables. Generally, you use the properties to pass values to methods
that complete actions on the associated objects.
AltConfidenceString property
The AltConfidenceString property sets or gets the confidence level of characters in
the field value.
VBScript restriction: Because extended properties are not supported through the
C# .NET Interop interface, you must instead use the “set_AltConfidenceString” on
page 45 method or the “get_AltConfidenceString method” on page 26 method.
Syntax
VBScript
oDCO.AltConfidenceString (nIndex as Long) as String.
Applies to
Type
Arguments
nIndex
0 specifies the primary value. Where the field contains multiple recognition,
Return value
VBScript example
The following example sets the confidence string for the first alternative in the
Total field:
objTotalField.AltConfidenceString(1) = "987999"
In the example, the Total field consists of 6 characters, and the confidence level of
each character is 9, 8, 7, 9, 9, and 9.
AltText property
The AltText property sets or gets the alternative character data that is associated
with a field. You use this property with multiple-pass verification tasks and when
you need to display alternative text options to an operator.
VBScript restriction: Because extended properties are not supported through the
C# .NET Interop interface, you must instead use the “set_AltText method” on page
46 or the “get_AltText method” on page 27.
Syntax
VBScript
oDCO.AltText (nIndex as Long) as String
Applies to
Type
Arguments
nIndex
0 specifies the primary value. When the field contains multiple recognition,
voting, or multiple-pass data entry values, 1 specifies the first alternative, 2
specifies the second alternative, and so on.
Returns
String containing the alternative text. The string is stored in the page XML file in
ASCII format.
VBScript example
This example shows the first alternative value (231.77) for the Total field that an
operator entered during a multiple-pass verification task.
objTotalField.AltText(1) = "231.77"
VBScript restriction: Because extended properties are not supported through the
C# .NET Interop interface, you must instead use the “set_CharConfidence method”
on page 47 or the “get_CharConfidence method” on page 28.
Syntax
VBScript
oDCO.CharConfidence (nIndex as Long) as Long
Applies to
Type
Arguments
nIndex
0 specifies the primary value. When the field contains multiple recognition,
voting, or multiple-pass data entry values, 1 specifies the first alternative, 2
specifies the second alternative, and so on.
VBScript example
This example sets the confidence level of the primary character to 9, or the highest
confidence level.
oDCO.CharConfidence(0)=9 ' high confidence
conf = oDCO.CharConfidence(0)
CharValue property
The CharValue property sets or gets the data value of a character, which can be a
digit in a multiple-digit number or a single character in a string. You can use this
property to search for or assign a value to a character in a field.
VBScript restriction: Because extended properties are not supported through the
C# .NET Interop interface, you must instead use the“set_CharValue method” on
page 48 or the “get_CharValue method” on page 29.
Syntax
VBScript
oDCO.CharValue (nIndex as Long) as String.
Applies to
Arguments
nIndex
0 specifies the primary value. When the field contains multiple recognition,
voting, or multiple-pass data entry values, 1 specifies the first alternative, 2
specifies the second alternative, and so on.
ConfidenceString property
The ConfidenceString property sets or gets the confidence values for the primary
character data in a field object.
In this XML sample for the Vendor field, the fourth character contains a confidence
level of 6 for the primary character value. The first alternative character value has
confidence level of 8, and the second alternative character value has a confidence
level of 4.
<F id="Vendor">
<V n="TYPE">Vendor</V>
<V n="Position">0,0,0,0</V>
<V n="Status">1</V>
<C cn="6,8,10" cr="0,0,0,0>83,49,53</C>
<C cn="6,8,10" cr="0,0,0,0>116,50,54</C>
<C cn="6,8,10" cr="0,0,0,0>105,51,55</C>
<C cn="6,8,4" cr="0,0,0,0>110,52,56</C>
Syntax
VBScript
oDCO.ConfidenceString as String
C#
string ConfidenceString { set; get; }
Applies to
Type
C# example
This example sets and gets the confidence string that is associated with the
primary character data in the Vendor field. The root of the search in this case is the
page object.
m_oDCOPage.FindChild("Vendor").ConfidenceString = "7777";
string strReturn = m_oDCOPage.FindChild("Vendor").ConfidenceString;
ID property
The ID property sets or gets the unique identifier of an object, which can be a
batch, document, or page.
This property provides access to the id attribute of an object. For example, the id
attribute for a batch, document, page, and field can be <B id="20100096">, <D
id="20100096.001.01">, <P id="TM000001">, and <F id="Vendor">. You can pass
the value of the id attribute to a variable or custom action.
Syntax
VBScript
oDCO.ID as String
C#
string ID { set; get; }
Applies to
All objects. The ID property typically has a value for a batch and for all child
nodes, including documents, pages, and fields, but not for characters.
Type
ImageName property
The ImageName property sets or gets the full path and the file name of the image
file that is associated with a page object. You can use this property when you are
modifying the order of pages in a batch.
Syntax
VBScript
oDCO.ImageName as String
C#
string ImageName { set; get; }
Applies to
Type
The following example sets and gets the full path and the file name for the image
file that is associated with the page object with ID "TM000001":
m_oDCO.FindChild("TM000001").ImageName = "C:\\Datacap\\APT\\batches
\\20100096.001\\tm000001.tif";
strImageName = m_oDCO.FindChild("TM000001").ImageName;
Status property
The Status property sets or gets the status of an object. The status is a numerical
value that indicates success, failure, error, problem, or other status that depends on
the type of object. For example, you can use this property to locate pages with a
status of 1, which indicates that there was a problem during the page identification
task.
This property provides access to the STATUS variable, which is one of the standard
variables that are installed with Datacap.
Syntax
VBScript
oDCO.Status as Long
C#
int Status { set; get; }
Applies to
Type
Text property
The Text property sets or gets the primary character data that is associated with a
field.
The characters of a field are stored as ASCII values in the page data XML file. In
this sample XML node for the Vendor field, the fourth character contains a
primary text value of 97. The first alternative text value is 52, and the second
alternative text value is 97.
<F id="Vendor">
<V n="TYPE">Vendor</V>
<V n="Position">0,0,0,0</V>
<V n="STATUS">1</V>
<C cn="10,8,10" cr="0,0,0,0>68,49,68</C>
<C cn="10,8,10" cr="0,0,0,0>97,50,97</C>
<C cn="10,8,10" cr="0,0,0,0>116,51,116</C>
<C cn="10,8,10" cr="0,0,0,0>97,52,97</C>
</F>
Syntax
VBScript
Text as String
C#
string Text { set; get; }
Type
C# example
This example sets the primary character data in the Vendor field to IBM. The
confidence values (cn attribute) are automatically set to high (9 in the code; 10 in
the page XML file).
m_oDCOPage.FindChild("Vendor").Text = "IBM";
v The text is the value that a task, such as Profiler, adds to a runtime field object.
v If you use this property to replace existing data, all characters are assigned high
confidence, unless you specify otherwise by using the ConfidenceString
property.
Type property
The Type property sets or gets the object name. You can use this property to search
for document types or page types in a batch and change the name of the object.
This property provides access to the TYPE variable, which is one of the standard
variables that are installed with Datacap.
Syntax
VBScript
objRT.Type as String
C#
string Type { set; get; }
Applies to
Type
Example
Variable property
The Variable property sets or gets the value of a named variable. You can use this
property when you first need to obtain a value that you pass afterward to another
variable or object, such as a field.
VBScript restriction: Because extended properties are not supported through the
C# .NET Interop interface, you must instead use set_Variable or get_Variable.
Arguments
lpszName
The name of the variable of which you need to set or get the value.
Applies to
All objects.
Type
VBScript example
This example checks the value of the Handwriting variable. If Handwriting is greater
than 0, then the code sets the value of the Checked variable to 1 to indicate that a
check box is selected.
If oDCO.Variable("HandWriting") > 0 Then
WriteLog("HandWriting is TRUE")
End If
oDCO.Variable("Checked") = 1
XML property
The XML property sets or gets the XML file that is associated with an object. You
can use this property to populate a run time object from the Setup DCO file and
assign the XML file to a variable.
Syntax
C#
string XML { set; get; }
Arguments
None.
Returns
Applies to
C# example
This example populates the runtime batch object from the DCO Setup file, and
then assigns the XML file to the variable strDCOXml.
m_oDCO.Read("C:\\Datacap\\APT\\batches\\20100096.001\\Verify.xml");
strDCOXml = m_oDCO.XML;
AddChild method
The AddChild method adds a child object to the parent runtime DCO object. You
can use the AddChild method to add a field to a page or add a page to a
document. You can add only a child that is at the same or a lower level than this
object in the hierarchy.
Syntax
VBScript
oDCO.AddChild (ObjectType as Long, ID as String,
Placement as Long) as Object
C#
TDCOLib.DCO AddChild(int nType, string lpszID, int nIndex)
Applies to
All objects.
Arguments
nType
The type of the child object:
0=Batch
1=Document
2=Page
3=Field
4=Character
lpszID
A string with the ID of the new object. Use an empty string for character
objects.
nIndex
The index of the child object relative to other child objects of the same parent.
If necessary, existing child objects are moved down to accommodate a new
child object.
-1: Adds the new child object to the end of the list.
0: Adds the new child object to the beginning of the list.
Returns
C# examples
The first example creates a field object under the parent page object. The field is
added to the page data file as the last field in the list by using a value of -1.
m_oDCOField = m_oDCOPage.AddChild(3, "NewField", -1);
AddValue method
The AddValue method adds a character data value (ASCII code) and the associated
confidence level to the character object. You can use this method to correct optical
character recognition (OCR) errors.
In addition to the primary data value, each character in a field can have multiple
alternative data values. Each of the alternative data values has an associated
confidence level (0 - 9 internally and 1 - 10 in the page XML file). Each time that
you add a value by using the AddValue method, the new value is appended to the
list of existing values. Also, a new confidence level is appended to the list of
existing confidence levels.
In the following example, the fourth character contains a primary confidence level
value of 6, a first alternative confidence level of 8, and a second alternative
confidence level of 10. The fourth character also contains a primary character value
of 110, a first alternative character value of 52, and a second alternative character
value of 56.
<F id="Vendor">
<V n="TYPE">Vendor</V>
<V n="Position">0,0,0,0</V>
<V n="STATUS">1</V>
<C n="6,8,10" cr="0,0,0,0">83,49,53</C>
<C n="6,8,10" cr="0,0,0,0">116,50,54</C>
<C n="6,8,10" cr="0,0,0,0">105,51,55/C>
<C n="6,8,10" cr="0,0,0,0">110,52,56</C>
</F>
Syntax
VBScript
oDCO.AddValue (Value as Long, Confidence as Long) as Boolean
C#
int AddValue(int nValue, int nConfidence)
Applies to
Arguments
nValue
The ASCII code of the character.
nConfidence
A number between 0 (low) and 9 (high) representing the confidence level.
C# example
This example adds the ASCII character 50 with a confidence level of 3 to the
character object:
m_oDCOChar.AddValue(50,3);
AddVariable method
The AddVariable method adds a variable and its value to an object, such as a
batch, document, page, or field. You can use this method when you need to pass
values to a custom action. For example, your organization might introduce a new
security regulation that requires a new field for identification on certain page
types.
Syntax
VBScript
oDCO.AddVariable (strName as String, newValue as Variant) as Boolean
C#
bool m_oDCO.AddVariable (string strName, object newValue)
Arguments
strName
The variable name.
newValue
The value of the variable.
Returns
Applies to
All objects.
Examples
VBScript
This example adds the Company variable with a value of IBM to the page
object.
Dim page
Call objField.AddVariable ("Company", IBM)
factor = objField.Variable("Company")
C# This example adds the variable Company and the value IBM to page
TM000001 in the runtime batch.
TDCOLib.IDCO m_oChild = m_oDCO.FindChild("TM000001");
if (m_oChild != null
)
{
m_oChild.AddVariable("Company", "IBM");
}
AddVariableFloat method
The AddVariableFloat method adds a variable of type double and its value to an
object.
Syntax
VBScript
oDCO.AddVariableFloat (strName as String, fValue as Double) as Boolean
C#
bool AddVariableFloat(string strName, double fValue)
Applies to
Arguments
strName
The variable name.
fValue
The value of the variable as a double.
Returns
Example
AddVariableInt method
The AddVariableInt method adds an integer variable and its value to an object.
You can use this method when you need to pass values to custom actions.
Syntax
VBScript
oDCO.AddVariableInt (strName as String, nValue as Integer) as Boolean.
C#
bool AddVariableInt(string strName, int nValue)
Applies to
Returns
Example
AddVariableString method
The AddVariableString method adds a string variable and its value to an object.
You can use this method when you need to pass values to custom actions.
Syntax
C#
bool AddVariableString(string strName, string strValue)
VBScript
oDCO.AddVariableString (strName as String, strValue as String) as Boolean
Applies to
Arguments
strName
The variable name.
strValue
The value of the variable as a string.
Returns
Example
CheckIntegrity method
The CheckIntegrity method determines whether a batch conforms to the
document integrity rules that are specified in the Setup DCO file.
This method is typically used after the “CreateDocuments method” on page 20.
Syntax
VBScript
oDCO CheckIntegrity (pLastChecked as Object ) as Long.
Arguments
pLastChecked
Variable to contain the last object that is checked in case of an error.
Returns
Applies to
All object types except character objects. When applied to a batch or document, the
method checks to the page level but not lower to a field or character object. When
applied to a page, the method checks fields on that page.
VBScript example
This example creates documents in a batch and applies integrity rules. If an error is
encountered, the code opens a message box that displays the type of error (1-4).
The message box also displays the object and the ID that are the source of the
error.
Dim DocInt
Dim LastChecked
Call oDCO.CreateDocuments
DocInt = oDCO.CheckIntegrity(LastChecked)
If DocInt > 0 Then
msgbox "Document Integrity problem = " & DocInt
msgbox "Detected at " & LastChecked.ObjectType & " type object ID " & LastChecked.ID
End If
C# example
This example populates the runtime and setup DCO objects, and checks the
integrity of the runtime batch.
m_oDCO.Read("C:\\Datacap\\APT\\batches\\20100096.001\\Verify.xml");
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
Object pLastChecked = null;
int nRetVal = m_oDCO.CheckIntegrity(out pLastChecked);
Clear method
The Clear method removes all of the child objects of a runtime object, but does not
remove the object itself. For example, you can use this method when a document
contains corrupted or incorrect pages.
Arguments
None.
Returns
Applies to
VBScript example
This example instantiates a field-level object, uses Clear( ) to remove any child
objects, and then assigns a value to the ID property of the object.
Dim objFldTwo
Set objFldTwo = DCOSetup.GetNode(3,8)
objFldTwo.Clear
objFldTwo.ID = Tax2
CreateDocuments method
The CreateDocuments method uses the Setup DCO file to determine the document
type that is associated with each page in a batch and creates the required
document objects.
This method is normally called after the page identification task to assign pages to
documents within the runtime hierarchy.
Syntax
VBScript
oDCO.CreateDocuments ( ) as Boolean.
C#
bool CreateDocuments()
Applies to
Arguments
None.
Returns
This example reads the Setup DCO file (BDOcs.xml), creates the document objects,
and confirms that the batch conforms to the document integrity rules.
Call oDCO.ReadSetup ("c:\Datacap\BDOcs\dco_APT\BDOcs.xml")
Call objBatch.CreateDocuments
Call objBatch.CheckIntegrity
CreateFields method
The CreateFields method creates a runtime field object for each field that is
specified within the corresponding page (or field) node in the document hierarchy.
For example, the 1040EZ page node in the following document hierarchy has rules
for three field objects. So, CreateFields( ) creates three field objects (Tax Year,
SSN, Spouse SSN).
<P type="1040EZ">
( <V n="ID">0</V>
<V n="TYPE">Page</V>
<V n="STATUS">0</V>
<V n="IMAGEFILE"></V>
<V n="DATAFILE"></V>
<V n="TEMPLATE IMAGE"></V>
<V n="MIN_TYPES">1</V>
<V n="MAX_TYPES">0</V>
<V n="rules"><in><r id="3" rs="4" /><r id="1" rs="5" /><r id="2" rs="6" /></in></V>
<F type="Tax Year" pos="0" min="0" max="0"/> <!-- Rule 0 -->
<F type="SSN" pos="0" min="0" max="0"/> <!-- Rule 1 -->
<F type="Spouse SSN" pos="0" min="0" max="0"/> <!-- Rule 2 -->
</P>
The child objects are used to hold the field data that is generated during the field
recognition process. This method ensures that a data file is created for the current
page when a batch is saved.
Syntax
VBScript
oDCO.CreateFields( ) as Boolean.
C#
bool CreateFields()
Arguments
None.
Returns
Applies to
DeleteChild method
The DeleteChild method removes the specified child object from the runtime DCO
object.
Applies to
Any object
Arguments
nIndex
Index of the child to delete, where 0 is the first child.
Returns
C# example
This example removes the first field object of the runtime page object.
m_oDCOPage.DeleteChild(0);
DeleteValue method
The DeleteValue method deletes a data value and the corresponding confidence
level value of a character object.
In the following example, the fourth character contains a primary confidence level
value of 6, a first alternative confidence level of 8, and a second alternative
confidence level of 10. The fourth character also contains a primary character value
of 110, a first alternative character value of 52, and a second alternative character
value of 56.
<F id="Vendor">
<V n="TYPE">Vendor</V>
<V n="Position">0,0,0,0</V>
<V n="STATUS">1</V>
<C n="6,8,10" cr="0,0,0,0">83,49,53</C>
<C n="6,8,10" cr="0,0,0,0">116,50,54</C>
<C n="6,8,10" cr="0,0,0,0">105,51,55/C>
<C n="6,8,10" cr="0,0,0,0">110,52,56</C>
</F>
Syntax
VBScript
oDCO.DeleteValue (nIndexValue as Long) as Boolean
C#
bool DeleteValue(int nIndexValue)
Applies to
Returns
C# example
This example deletes the first alternative character value and the first alternative
confidence level value.
m_oDCOChar.DeleteValue(1);
DeleteVariable method
The DeleteVariable method removes a variable, including variables such as TYPE
or STATUS that are installed with Datacap, and its value from a runtime DCO
object.
Syntax
VBScript
oDCO.DeleteVariable (lpszName as String ) as Boolean
C#
bool DeleteVariable(string lpszName)
Applies to
All objects.
Arguments
lpszName
The name of the variable to delete (case sensitive).
Returns
FindChild method
The FindChild method gets an interface to a child object that is referenced by ID
(name). You can use this method when you need to get the interface to a child
object for which you only know the name.
If the method references a field and the same ID is used within multiple page
objects, the method returns the first matching field.
Syntax
VBScript
oDCO FindChild (lpszName as String ) as Boolean.
Arguments
lpszName
The ID (name) of the child object.
Returns
Applies to
All objects.
VBScript example
This example returns the interface to the Client_ID field, and displays the interface
in a message box.
Dim objRTClFld
Set objRTClFld=oDCO.FindChild("Client_ID")
msgbox objRTClFld.ID
To retrieve a child object by index instead of ID, use “GetChild method” on page
31
C# example
FindChildIndex method
The FindChildIndex method returns the index of the specified child object that is
contained within a runtime DCO object. You can use this method when you know
the name of the child object, and you need to pass the position of the child object
to a variable.
Syntax
VBScript
oDCO FindChildIndex (lpszName as String ) as Long
C#
int FindChildIndex(string lpszName)
Applies to
Arguments
lpszName
The ID (name) of the child object.
Returns the index of the specified child object, where 0 is the first child; returns –1
if the specified child is not found.
VBScript example
This example returns the index of the Client_ID field, and passes the index to the
GetChild method.
Dim ClientFldVal
ClientFldVal = objRTSurvey.FindChildIndex("Client_ID")
Call objRTSurvey.GetChild(ClientFldVal)
C# example
FindRouteChild method
The FindRouteChild method returns the interface to an object that is specified by
using the path through the document hierarchy. You use this method to save or
restore execution points during an action process.
The use of the path through a document hierarchy is shown in this example:
B/D(20100028.002.01)/P(TM000001)/F(Vendor)
Syntax
C#
TDCOLib.DCO FindRouteChild(string bszRoute)
Arguments
bszRoute
The route through the document hierarchy. (See the C# example.)
Returns
Returns an interface to the specified object; returns null if the route is invalid.
C# example
This example gets an interface to the Vendor field object on page TM000001:
m_oDCOField = m_oDCO.FindRouteChild("B/D(20100028.002.01)/P(TM000001)/F(Vendor)");
FindVariable method
The FindVariable method returns the index of a variable by using the ID (name)
of the variable. You can use this method when you need to pass the value of a
variable to another variable or action.
Syntax
VBScript
oDCO FindVariable (lpszName as String ) Variables Index subscript as Long
C#
int FindVariable(string lpszName)
Returns
Returns the index of the specified variable, where 0 is the first variable; Returns –1
if the specified variable is not found.
Applies to
All objects.
VBScript example
This example returns the index of the Length variable, and displays the index in a
message box:
Dim VarLength
varLength = oDCO.FindVariable("Length")
if varLength > 0 then
msgbox oDCO.Variable(varLength)
end if
get_AltConfidenceString method
The get_AltConfidenceString method gets the confidence level of each character
in the referenced field. You can use this method when you need to pass the
confidence level of a string to a variable or action.
Syntax
C#
string get_AltConfidenceString(int nIndex)
Applies to
Returns
String containing the confidence level of each character. The returned digits are
always one less than the digits that are stored in the page XML file. (See the C#
example.)
C# example
The following example gets the confidence string for the second alternative.
string strAltConf = m_oVendorField.get_AltConfidenceString(2)
Referencing the XML code example for the Vendor field, the return value in this
case is 9999, because the returned value is always the stored value minus 1.
get_AltText method
The get_AltText method gets the primary or alternative character data that is
associated with a field.
Primary and alternative values are stored in ASCII format in the page XML file, as
shown in the following example:
<F id="Vendor">
<V n="TYPE">Vendor</V>
<V n="Position">0,0,0,0</V>
<V n="STATUS">1</V>
<C n="6,8,10" cr="0,0,0,0">83,49,68</C>
<C n="6,8,10" cr="0,0,0,0">116,50,97</C>
<C n="6,8,10" cr="0,0,0,0">105,51,116/C>
<C n="6,8,10" cr="0,0,0,0">110,52,97</C>
</F>
For the fourth character, the primary text value is 110. The first alternative text
value is 52, and the second alternative text value is 97.
Syntax
C#
string get_AltText(int nIndex)
Applies to
Arguments
nIndex
0 specifies the primary value. When the field contains multiple recognition,
voting, or multiple-pass data entry values, 1 specifies the first alternative, 2
specifies the second alternative, and so on.
Example
This example gets the second alternative text value from the Vendor field. Using
the page XML example, the returned string is 68,97,116,97. The root of the search
in this case is the page DCO.
string sAltText = m_oDCOPage.FindChild("Vendor").get_AltText(2);
get_CharConfidence method
The get_CharConfidence method gets the primary or alternative character data that
is associated with a field. You can use this method when you need to pass the
character data value to a variable or action.
This method gets the confidence level (cn) of the primary character value or
alternative value. Within the XML file, the confidence level is a digit from 1 (lowest
confidence) to 10 (highest confidence). In the following example XML setup node
for the field, Vendor, the character primary confidence level is 6. The first
alternative confidence level is 8, and the second alternative confidence level is 10.
<F id="Vendor">
<V n="TYPE">Vendor</V>
<V n="Position">0,0,0,0</V>
<V n="STATUS">1</V>
<C cn="6,8,10" cr="0,0,0,0">83,49,53</C>
<C cn="6,8,10" cr="0,0,0,0">116,50,54</C>
<C cn="6,8,10" cr="0,0,0,0">105,51,55/C>
<C cn="6,8,4" cr="0,0,0,0">110,52,56</C>
</F>
Syntax
C#
int get_CharConfidence(int nIndex)
Applies to
Arguments
nIndex
0 specifies the primary value. When the field contains multiple recognition,
voting, or multiple-pass data entry values, 1 specifies the first alternative, 2
specifies the second alternative, and so on.
Returns
This example gets the confidence level of second alternative value of the fourth
character (index = 3) in the Vendor field. By using the example XML setup node,
the returned value is 4. The root of the search in this case is the page DCO.
nConfLevel = m_oDCOPage.FindChild("Vendor").GetChild(3).get_CharConfidence(2);
get_CharValue method
The get_CharValue method gets the ASCII data value of the primary character or
alternative character. You can use this method when you need to pass the character
data value to a variable or action.
In the following example XML setup node for the field, Vendor, the fourth
character has an ASCII data value of 110 for the primary character. Also, the ASCII
data value is 52 for the first alternative character and 56 for the second alternative
character.
<F id="Vendor">
<V n="TYPE">Vendor</V>
<V n="Position">0,0,0,0</V>
<V n="STATUS">1</V>
<C cn="6,8,10" cr="0,0,0,0">83,49,53</C>
<C cn="6,8,10" cr="0,0,0,0">116,50,54</C>
<C cn="6,8,10" cr="0,0,0,0">105,51,55/C>
<C cn="6,8,10" cr="0,0,0,0">110,52,56</C>
</F>
Syntax
C#
int get_CharValue(int nIndex)
Applies to
Arguments
nIndex
0 specifies the primary value. Where the field contains multiple recognition,
voting, or multi-pass data entry values, 1 specifies the first alternative, 2
specifies the second alternative, and so on.
Returns
C# example
This example gets the second alternative value of the fourth character (index = 3)
in the Vendor field. By using the example XML setup node, the returned value is
56. The root of the search in this case is the page DCO.
nCharValue = m_oDCOPage.FindChild("Vendor").GetChild(3).get_CharValue(2);
Each character in an OMR field is assigned the value 0 (ASCII 48 = not selected) or
1 (ASCII 49 = selected), and the resulting binary string is expressed as a decimal.
The following XML example is 000100, which equals 4 in decimal. So, the return
value is 4.
<F id="1a">
<V n="TYPE">1a</V>
<V n="Position">120,1025,853,1169</V>
<V n="STATUS">0</V>
<V n="DensityString">BAAVAA</V>
<C cn="10" cr="519,1132,559,1170">48</C> <!--48 indicates option not selected-->
<C cn="10" cr="563,1132,603,1170">48</C>
<C cn="10" cr="607,1132,647,1170">48</C>
<C cn="10" cr="652,1132,692,1170">49</C> <!--49 indicates option selected-->
<C cn="10" cr="697,1132,737,1170">48</C>
<C cn="10" cr="763,1132,803,1170">48</C>
</F>
Syntax
C#
int get_OMRValue(int nIndex)
Arguments
nIndex
0 specifies the primary value. When the field contains multiple recognition,
voting, or multi-pass data entry values, 1 specifies the first alternative, 2
specifies the second alternative, and so on.
Returns
The positions of the selected OMR check boxes (See the XML example.)
Applies to
get_Variable method
The get_Variable method gets the value of a referenced variable by using the ID
(name) of the variable. You can use this method to pass the value of a named
variable to an action for further processing.
If the specified variable does not exist in the runtime object, but does exist in the
associated setup node object, the get_Variable method returns the value from the
setup node.
A number of variables are defined and installed with Datacap. For a listing of
these variables, see the Standard Variable Reference in IBM® Knowledge Center for
Datacap.
Arguments
lpszName
The name of the variable of which you need the value.
Applies to
All objects.
C# example
GetChild method
The GetChild method gets a referenced child object by using the index of the child
object. You can use this method to retrieve a field on a page when you know the
position, but not the name.
Syntax
VBScript
oDCO GetChild (nIndex as Long ) as Object
C#
TDCOLib.DCO GetChild(int nIndex)
Arguments
nIndex
The index of the child, where 0 is the first child
Returns
Applies to
All objects.
VBScript example
This example gets the name of the first four fields on a page, and displays each
name in a message box.
Dim objViewField(4)
Dim I
i = 0
Do While i < 4
Set objViewField(i) = oDCO.GetChild(i)
msgbox objViewField(i).Text
i = i + 1
Loop
GetLastError method
The GetLastError method retrieves the text of the last error that is encountered
during a DCO read operation or write operation, and clears the error.
Before you call the GetLastError method, you can check whether an error string
exists by calling the “IsError method” on page 36.
Syntax
VBScript
objRTBatch.GetLastError as Boolean
C#
string GetLastError()
Arguments
None.
Returns
Applies to
VBScript example
This example
objBatch.BatchDir = c:\Datacap\MQSW\Batches
bStatus = objBatch.Write rulerunner.xml
If bStatus <> True Then
msgbox objBatch.GetLastError
End if
GetPosition method
The GetPosition method gets the position of a field or character on a page. You
can use this method for fields or characters that are located at identical positions
on multiple pages in a batch.
v For field objects, the position is defined by the Position variable of the field.
<V n="Position">0,0,0,0</V>
v For character objects, the position is defined by the cr attribute of the character.
<C cn="10" cr="0,0,0,0">83</C>
Arguments
Argument Description
pnLeft Variable for the distance from the left side of
the page to the left edge of the object (in
pixels)
pnTop Variable for the distance from the top of the
page to top edge of the object (in pixels)
pnRight Variable for the distance from the left side of
the page to right edge of the object (in
pixels)
pnBottom Variable for the distance from the top of the
page to bottom edge of the object (in pixels)
Returns
Applies to
VBScript example
This example gets a field's distance in pixels from the left, top, right, and bottom of
a page, and displays the values in a message box.
Dim L,T,R,B
oDCO.GetPosition "L,T,R,B"
msgbox "The field’s position is " L & "," & T & "," & R & "," & B
C# example
This example finds the Vendor field on a page, and gets the field's distance in
pixels from the left, top, right, and bottom of a page.
m_oDCOField = m_oDCOPage.FindChild("Vendor");
object pLeft, pTop, pRight, pBottom;
m_oDCOField.GetPosition(out pLeft, out pTop, out pRight, out pBottom);
GetRoute method
The GetRoute method gets the path through the document hierarchy to an object.
Use the argument to specify whether you want the path through the Runtime DCO
(True) or the Setup DCO (False).
Syntax
C#
string GetRoute(bool bRuntime)
Returns
Applies to
C# example
In the first example, GetRoute( ) returns the path through the Runtime DCO to the
Vendor field on page TM000001.
m_oDCO.Read("C:\\Datacap\\APT\\batches\\20100096.001\\Verify.xml");
m_oDCOPage = m_oDCO.FindChild("TM000001");
m_oDCOField = m_oDCOPage.FindChild("Vendor");
string strRoute = m_oDCOField.GetRoute(true);
In the next example, GetRoute( ) returns the path through the Setup DCO to the
Details field.
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
m_oDCOField = m_oDCO.FindChild("Details");
string returnString = m_oDCOField.GetRoute(false);
GetVariableName method
The GetVariableName method gets the name (ID) of a variable from the index of the
variable. You can use this method when you know the position of a variable
within an object, but you do not know the name of the variable.
Syntax
VBScript
oDCO.VariableName(nIndex subscript as Long) as String
C#
string GetVariableName(int nIndex)
Applies to
All objects.
Arguments
nIndex
The index of the variable.
Returns the name of the variable; returns an empty string if a variable with the
specified index does not exist.
VBScript example
This example returns the name of the third variable in a field object.
Dim VarID
VarID = objField.VariableName(2)
GetVariableValue method
The GetVariableValue method gets the value of a referenced variable by using the
index of the variable.
Syntax
VBScript
oDCO.VariableName(nIndex subscript as Long) as Variant
C#
object GetVariableValue(int nIndex)
Applies to
All objects.
Arguments
nIndex
The index of the variable, the value of which you want to get, where 0 is the
first variable.
Returns
Returns an object that contains the value of the variable; returns nothing if there is
an error.
VBScript example
This example gets the value of the third variable in a field object, and displays the
value of the variable in a message box.
Dim VarVal
VarVal = objField.VariableValue(2)
msgbox VarVal
Tip: To get the value of a referenced variable by using the ID (name) of the
variable, use the “Variable property” on page 12 property.
C# example
This example gets the value of the 10th variable that is defined on page 1 of the
runtime batch.
object oVarValue = m_oDCO.FindChild("TM000001").GetVariableValue(9);
Tip: To get the value of a referenced variable by using the ID (name) of the
variable, use the “get_Variable method” on page 30 method.
If IsError returns true, use the “GetLastError method” on page 32 to get the
associated error message. The IsError flag is cleared upon calling GetLastError.
Syntax
VBScript
oDCO.IsError as Boolean
C#
bool IsError()
Applies to
Arguments
None.
Returns
Returns true if the IsError flag is set; Returns false if the IsError flag is not set.
VBScript example
This example checks if there are any errors for the Rulerunner task. If an error is
found, it displays the error to a message box.
objBatch.BatchDir = "c:\Datacap\MQSW\Batches"
’ clear any old errors
sOldError = objBatch.GetLastError
Call objBatch.Write ("rulerunner.xml")
If objBatch.IsError <> 0 Then
msgbox objBatch.GetLastError
End if
IsRoute method
The IsRoute method indicates whether the specified path is the valid path through
the runtime hierarchy for an object.
Syntax
C#
bool IsRoute(string lpszRoute)
Arguments
lpszRoute
The path through the runtime hierarchy. (See the C# example.)
Returns
Returns true if the specified path matches the path for this object; returns false if
the specified path does not match the path for this object.
The following example gets an interface to the Vendor field and then uses
GetRoute to confirm the path.
m_oDCOField = m_oDCO.FindChild("TM000001").FindChild("Vendor");
bool bRouteOK = m_oDCOField.IsRoute("B/D(20100028.002.01)/P(TM000001)/F(Vendor)");
IsValid method
The IsValid method confirms that the interface of a DCO object is valid and is
connected to an actual object.
Syntax
VBScript
oDCO.IsValid as Boolean
C#
bool IsValid()
Arguments
None.
Returns
Returns true if the interface is valid; returns false if the interface is invalid.
Applies to
C# example
MoveChild method
The MoveChild method moves a child of a runtime DCO object to a different index
location. You can use this method to reorganize or correct batches, documents,
pages, or fields.
Description
Arguments
nOldIndex
Index value of the current position, of the child object, where 0 is the first child
nNewIndex
Index value of the new position of the child object
Returns
Applies to
All objects
C# Example
This example moves the first field on page TM000001 to the third position.
m_oDCO.FindChild("TM000001").MoveChild(0, 2);
See also
MoveIn method
The MoveIn method moves the specified runtime DCO object from the current
parent to a different parent.
Syntax
VBScript
oDCO.MoveIn(pNewParent as Object, nIndex as Long) as Boolean.
C#
bool MoveIn(object pNewParent, int nIndex)
Applies to
All objects
Arguments
pNewParent
A valid runtime DCO object as the new parent
nIndex
The index value for the child in the new parent. An index value of -1 places
the child at the end.
C# Example
The following example moves the Vendor field from page TM000002 to the end of
page TM000001.
m_oDCOField = m_oDCO.FindChild("TM000002").FindChild("Vendor");
m_oDCOPage = m_oDCO.FindChild("TM000001");
m_oDCOField.MoveIn(m_oDCOPage, -1);
See also
NumOfChildren method
The NumOfChildren method returns the number of child objects that is associated
with the runtime DCO object.
Syntax
VBScript
oDCO.NumOfChildren as Long
C#
int NumOfChildren()
Arguments
None
Returns
Applies to
All objects
VBScript Example
Dim CntPgChildren
CntPgChildren = oDCO.NumOfChildren
msgbox "Page 1 has " & CntPgChildren & " children"
C# Example
See also
NumOfVars method
The NumOfVars method returns the number of variables that is associated with the
runtime DCO object.
Arguments
None
Returns
Applies to
All objects
Example
This example returns the number of variables that is associated with the Vendor
field.
int nNumVars = m_oDCO.FindChild("TM000001").FindChild("Vendor").NumOfChildren();
See also
ObjectType method
The ObjectType method returns a numeric value that indicates the object type.
Syntax
VBScript
oDCO.ObjectType as Long
C#
int ObjectType()
Arguments
None.
Returns
A value that indicates the object type (0=batch, 1=document, 2=page, 3=field,
4=character).
Applies to
All objects
Parent
The Parent method returns the parent of the runtime DCO object.
Syntax
VBScript
oDCO.Parent as oDCO Object
C#
TDCOLib.DCO Parent()
Arguments
None
Returns
The parent object, or nothing (null) if the method is applied to a batch object.
Applies to
Example
VBScript
If oField.Parent = Nothing Then
msgbox "Cannot access the page!"
End if
Read method
The Read method reads the runtime information from a Runtime DCO file or a
page data file, and writes the information into the DCO object.
This method can read a Runtime DCO file (for example, Verify.xml), or a page
data file (for example, tm000001.xml) of an application. Because new DCO objects
are created as batch objects by default, you must first create a child object of type
page before using the Read method to directly read the page data file. Runtime
information files are located in the batches folder of an application, and include
the data that are denoted by the following properties:
|--m_oDCO
|--BatchDir(string)
|--BatchPriority(int)
|--ConfidenceString(string
|--ID(string)
|--ImageName(string)
|--Options(string)
|--Status(int)
|--Text(string)
|--Type(string)
|--XML(string)
|--AltConfidenceString(string)*
|--AltText(string)*
* These extended properties are accessible directly from VBScript or through the
corresponding get method or set method in .NET.
Syntax
VBScript
oDCO.Read (FilePath as String) as Boolean
C#
bool Read(string lpszFileName)
Applies to
Arguments
lpszFileName
The full path and name of the file to read.
Returns
Example
The first example reads the Runtime DCO file into an existing batch level DCO
object:
m_oDCOBatch.Read("C:\\Datacap\\APT\\batches\\20100096.001\\Verify.xml");
The second example creates a runtime DCO object with a page data file only:
TDCOLib.DCO m_oDCO = new TDCOLib.DCO();
TDCOLib.DCO m_oDCOPage = new TDCOLib.DCO();
m_oDCOPage = m_oDCO.AddChild(2, "NewChildPage", -1);
m_oDCOPage.Read("C:\\Datacap\\APT\\batches\\20100096.001\\tm000001.xml");
If there is an error, the “IsError method” on page 36 returns true and the
“GetLastError method” on page 32 returns the last error message.
ReadSetup method
The ReadSetup method reads the document hierarchy setup information from the
specified Setup DCO file and writes the information into the Setup object and
SetupNode object.
This sample file shows properties that the ReadSetup method can process.
|--Setup
|--Path(string)
|--DictionaryName*
|--Value*
|--Word*
|--SetupNode
|--MaxNumOfChildren(int)
|--MinNumOfChildren(int)
|--Name(string)
* Extended properties that are accessible directly from VBScript or through the
corresponding get method or set method in .NET.
Syntax
VBScript
oDCO.ReadSetup (FileName as String) as Boolean
C#
bool IDCO.ReadSetup(string lpszFileName)
Arguments
lpszFileName
Full path and name for the Setup DCO XML file. (See the following example.)
Returns
C# example
This example populates the Setup object and SetupNode object from APT.XML,
changes the name of the first dictionary to Datacap, and writes the objects back to
the Setup DCO.
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
m_oDCO.SetupObject().set_DictionaryName(0, "Datacap");
m_oDCO.WriteSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
SetPosition method
The SetPosition method sets the position of the runtime field or character object
on the page. This method is useful for making corrections to zonal recognition on a
page.
v For field objects, the position is defined by the Position variable of the field.
<V n="Position">0,0,0,0</V>
v For character objects, the position is defined by the cr attribute of the character.
<C cn="10" cr="0,0,0,0">83</C>
Syntax
VBScript
oDCO.SetPosition (nLeft as Long, nTop as Long, nRight as Long,
nBottom as Long) as Boolean
C#
bool SetPosition(int nLeft, int nTop, int nRight, int nBottom)
Applies to
Returns
Example
VBScript
Call oDCO.SetPosition (115, 450, 138, 400)
SetupNode method
The SetupNode method accesses the SetupNode object that is associated with the
current object. You can use this method to get the name of the object in the
document hierarchy that corresponds to the object in the runtime batch hierarchy.
Syntax
VBScript
oDCO.SetupNode as Object
C#
TDCOLib.DCOSetupNode SetupNode()
Arguments
None.
Returns
The setup object that corresponds to this runtime object. If you created this object
dynamically at run time, and the object is not based on a SetupNode, then the
method returns nothing (null).
Applies to
All objects.
C# example
This example populates the batch level Setup object and SetupNode object from
the Setup DCO file and points m_oDCOSetupNode to the SetupNode object of the
Vendor field.
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
TDCOLib.DCOSetupNode m_oDCOSetupNode = m_oDCO.FindChild("TM000001").FindChild("Vendor").SetupNode();
Syntax
VBScript
oDCO.SetupObject as Object
C#
TDCOLib.DCOSetup SetupObject()
Applies to
Arguments
None.
Returns
C# example
This example populates the batch level Setup and SetupNode objects from the
Setup DCO file and points m_oDCOSetup to the Setup object:
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
TDCOLib.DCOSetup m_oDCOSetup = m_oDCO.SetupObject();
set_AltConfidenceString
The set_AltConfidenceString method sets the confidence level of each character in
the referenced field.
Description
Important: .NET only. For VBScript, use the AltConfidenceString property instead.
In the sample XML file, the primary confidence level is 6. The first alternative
confidence level is 8, and the second alternative confidence level is 10. The value
that is stored is always the value set + 1.
Applies to
Arguments
nIndex
0 specifies the primary value. Where the field contains multiple recognition,
voting, or multipass data entry values, 1 specifies the first alternative, 2
specifies the second alternative, and son on. (See the following example).
pVal
A string that contains containing the confidence level of each character (for
example, "9999"). The digits that are stored in the page XML file are always
one greater than the digits you specify in pVal (See the following example).
Comments
v To set or get the primary confidence level, you can also use the ConfidenceString
property.
v To set or get the confidence level on individual characters, use
set_CharConfidence or get_CharConfidence.
Example
C#
The following example sets the confidence string for the second alternative.
m_oVendorField.set_AltConfidenceString(2, "9999")
The value 9999 is stored as 10,10,10,10 because the value that is stored is
always the value set + 1.
See also
get_AltConfidenceString, set_AltText
set_AltText method
The set_AltText method sets the primary character data or alternative character
data that is associated with a field. You can use this method for multi-pass
verification tasks and double-blind data entry tasks.
The set_AltText method sets primary and alternative values that are stored in the
page XML file in ASCII format, as shown in the following example:
F id="Vendor">
<V n="TYPE">Vendor</V>
<V n="Position">0,0,0,0</V>
<V n="STATUS">1</V>
<C cn="6,8,10" cr="0,0,0,0">83,49,68</C>
<C cn="6,8,10" cr="0,0,0,0">116,50,97</C>
<C cn="6,8,10" cr="0,0,0,0">105,51,116</C>
<C cn="6,8,10" cr="0,0,0,0">110,52,97</C>
</F>
Syntax
C#
void set_AltText(int nIndex, string pVal)
Applies to
Arguments
nIndex
0 specifies the primary value. Where the field contains multiple recognition,
voting, or multi-pass data entry values, 1 specifies the first alternative, 2
specifies the second alternative, and so on.
pVal
String containing the alternative text.
C# example
set_CharConfidence method
The set_CharConfidence method sets the confidence level for the primary value or
of the alternative value of a character in a field.
The confidence level is determined by the cn attribute. Within the page XML file,
the confidence level is a digit from 1 (lowest confidence) to 10 (highest confidence).
In the following XML sample, the primary confidence level of the fourth character
is 6. The first alternative confidence level is 8, and the second alternative
confidence level is 4.
F id="Vendor">
<V n="TYPE">Vendor</V>
<V n="Position">0,0,0,0</V>
<V n="STATUS">1</V>
<C cn="6,8,10" cr="0,0,0,0">83,49,53</C>
<C cn="6,8,10" cr="0,0,0,0">116,50,54</C>
<C cn="6,8,10" cr="0,0,0,0">105,51,55</C>
<C cn="6,8,4" cr="0,0,0,0">110,52,56</C>
</F>
Syntax
C#
void set_CharConfidence(int nIndex, int pVal)
This method sets the value as it is stored in the XML file (1-10). For field-level
functions such as set_AltConfidenceString, you specify the internal representation,
which is the stored value minus 1.
C# example
This example sets the confidence level of second alternative value of the fourth
character (index = 3) in the Vendor field. The root of the search in this case is the
page DCO.
m_oDCOPage.FindChild("Vendor").GetChild(3).set_CharConfidence(2, 4);
set_CharValue method
The set_CharValue method sets the ASCII data value of the primary character or
alternative character.
To set the text of the entire field, use the set_AltText. In the following sample XML
file, the primary value for the fourth character is 110. The first alternative value is
52, and the second alternative value is 56.
F id="Vendor">
<V n="TYPE">Vendor</V>
<V n="Position">0,0,0,0</V>
<V n="STATUS">1</V>
<C cn="6,8,10" cr="0,0,0,0">83,49,53</C>
<C cn="6,8,10" cr="0,0,0,0">116,50,54</C>
<C cn="6,8,10" cr="0,0,0,0">105,51,55</C>
<C cn="6,8,10" cr="0,0,0,0">110,52,56</C>
</F>
Syntax
C#
void set_CharValue(int nIndex, int pVal)
Applies to
Arguments
nIndex
0 specifies the primary value. Where the field contains multiple recognition,
voting, or multipass data entry values, 1 specifies the first alternative, 2
specifies the second alternative, and so on.
Returns
Nothing.
This example sets the second alternative value of the fourth character (index = 3)
in the Vendor field. The root of the search in this case is the page DCO.
m_oDCOPage.FindChild("Vendor").GetChild(3).set_CharValue(2, 56);
set_OMRValue
The set_OMRValue method sets the character values within the OMR field to
indicate whether a check box is selected.
Description
Each character is assigned the value 0 (ASCII 48; not selected) or 1 (ASCII 49;
selected) and the resulting binary string is expressed as a decimal. The following
XML example represents a row of six check boxes and the binary string is 001000,
which equals 8 in decimal. So, the required value is 8.
<F id="1a">
<V n="TYPE">1a</V>
<V n="Position">120,1025,853,1169</V>
<V n="STATUS">0</V>
<V n="DensityString">BAAVAA</V>
<C cn="10" cr="519,1132,559,1170">48</C> <-- 48 indicates option not selected
<C cn="10" cr="563,1132,603,1170">48</C>
<C cn="10" cr="607,1132,647,1170">48</C>
<C cn="10" cr="652,1132,692,1170">49</C> <-- 49 indicates option selected
<C cn="10" cr="697,1132,737,1170">48</C>
<C cn="10" cr="763,1132,803,1170">48</C>
</F>
Syntax
C#
void set_OMRValue(int nIndex, int pVal)
Arguments
nIndex
0 specifies the primary value. Where the field contains multiple recognition,
voting, or multi-pass data entry values, 1 specifies the first alternative, 2
specifies the second alternative, and so on.
pVal
A number that reflects the state of each OMR check box. (See the XML
example.)
See also
get_OMRValue, get_CharValue
set_Variable method
The set_Variable method sets the value of a referenced variable by using the
name of the variable.
Description
If you set a variable that does not exist in the runtime object, this method
automatically creates the variable.
Syntax
C#
string set_Variable(string lpszName, string pVal)
Arguments
lpszName
The name of the variable, the value of which you want to set.
pVal
The value.
Applies to
All objects.
C# example
The following example assigns the value IBM to the variable Company.
m_oDCO.set_Variable("Company", "IBM")
The method either sets the value if the variable exists, or creates a new variable
with the specified value. The following sample XML node shows the resulting
variable and the value:
<V n="Company">IBM</V>
Write method
The Write method saves the runtime batch object to a batch file, or a page object to
a page file. When it writes a batch object, this method also writes all of the child
objects, including documents, pages, and fields.
When you create a batch with an application that you developed in Datacap
Studio, Datacap saves the batch as an XML file. The file is named after the last
completed task in the workflow of the application. When you create a batch with
an application that you developed outside of Datacap Studio, you can use the
Write method to save the batch object to a file.
Syntax
VBScript
oDCO.Write(lpszFileName as String) as Boolean
C#
bool Write(string lpszFileName)
Applies to
Arguments
lpszFileName
The full path and name of the output file.
C# example
This example writes the 20030086.003 batch object and the page objects of the
batch to Verify.xml file.
bStatus = objBatch.Write ("c:\Datacap\MQSW\Batches\20030085.003\Verify.xml")
objPage.CreateFields
bStatus = objPage.Write ("c:\Datacap\BDOcs\Batches\20030085.003" & objPage.ID)
WriteSetup method
The WriteSetup method writes the Setup object and SetupNode objects to the
Setup DCO file. You use this method after you read a setup DCO file from an
external location.
Syntax
VBScript
oDCO.WriteSetup(FileName as String) as Boolean
C#
bool WriteSetup(string lpszFileName)
Applies to
Arguments
lpszFileName
Full path and name for the Setup DCO file (for example, C:\Datacap\APT\
dco_APT\APT.xml).
Returns
Example
DCOSetup API
The DCOSetup APIs include properties and methods that you can use to create or
modify the document hierarchy. Datacap saves the document hierarchy as the
setup DCO file in XML format, for example, C:\Datacap\application
name\dco_application name\application name.xml.
In the setup DCO file, each document, page, and field type is defined as a separate
node, as shown in this sample XML code:
<?xml-stylesheet type="text/xsl" href="..\..\dco.xsl"?>
<S>
<B type="batch_name"> 1
</B>
</D>
</P>
</F>
</DICT>
When you use an API to populate the DCOSetup object with child nodes from the
Setup DCO file, each node becomes a separate DCOSetupNode object.
You use the DCOSetup APIs to modify the DCOSetup object and use the
DCOSetupNode APIs to modify the child DCOSetupNode objects.
\dco_<app_name> DCOSetup
object Custom
<B> application
<D>
DCOSetup API
<P>
<F>
Setup DCO
DCOSetupNode DCOSetupNode
object object
When you create a runtime DCO object (m_oDCO in this example), Datacap
automatically creates a corresponding DCOSetup object and updates the setup
DCO file.
TDCOLib.IDCO m_oDCO = new TDCOLib.DCOClass();
Runtime DCO
object
DCO API
DCOSetup
object
DCOSetup API
You can use the SetupObject method to access the DCOSetup object either directly
or by first obtaining an interface to the DCOSetup object:
Accessing the DCOSetup Object Directly
m_oDCO.SetupObject().AddNode(1,"NewDoc1");
Accessing the DCOSetup object through an interface
TDCOLib.DCOSetup m_oDCOSetup = m_oDCO.SetupObject();
//Obtaining an interface
m_oDCOSetup.AddNode(1,"NewDoc2");
//Accessing the DCOSetup object through the interface
The DCOSetup object is initially null. You populate the DCOSetup object and the
child objects in one of the following ways:
Use the ReadSetup method from an existing Setup DCO file
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
The ReadSetup method parses the XML file and creates all of the child
DCOSetupNode objects, such as documents, pages, and fields, that are
defined for the document hierarchy.
Use the AddNode method
m_oDCO.SetupObject().AddNode(1,"NewDoc1");
DCOSetup properties
You can use DCOSetup properties to access DCOSetup objects and modify
metadata, including dictionary paths, terms, names, and key values that are used
in verification tasks.
DictionaryName property
The DictionaryName property sets or gets the name of a dictionary in the Setup
DCO.
VBScript only: Because extended properties are not supported through the C#
.NET Interop interface, you must instead use the “set_DictionaryName method” on
page 64 or the “get_DictionaryName method” on page 59.
Syntax
VBScript
oSO.DictionaryName(DictIndex as Long) as String
Arguments
DictIndex
The number that indicates the location of the dictionary in the setup DCO,
with 0 being the first dictionary, 1 being the second, and so on.
Type
VBScript example
This example sets the name of the first dictionary in the setup DCO file to Vendors
and the name of the second dictionary to Customers.
oSO.DictionaryName(0) = "Vendors"
oSO.DictionaryName(1) = "Customers"
Path property
The Path property sets or gets the path to the setup DCO file.
Syntax
VBScript
oSO.Path as String
C#
string Path { set; get; }
Type
This example sets the path to the BDCcs.xml setup DCO file:
oSO.Path = "c:\Datacap\BDOcs\dco_BDOcs\BDOcs.xml"
Value property
The Value property sets or gets the key value of a dictionary term in the Setup
DCO file. You can use this property when you need to pass a value to a variable.
VBScript restriction: Because extended properties are not supported through the
C# .NET Interop interface, you must instead use the “set_Value method” on page
65 or the “get_Value method” on page 59.
The following example defines one dictionary with four words, where
RoutingInstructions is the dictionary name. The text in each set of quotation
marks is the key value that is associated with the word that follows it. Datacap
uses the key value to identify words in the dictionary that are displayed to an
operator during a verification task. Datacap populates the associated field with the
word that the operator selects.
<DICT n="RoutingInstructions">
<W v="None">None</W>
<W v="Delete">Delete</W>
<W v="Rescan">Rescan</W>
<W v="Review">Review</W>
</DICT>
Syntax
VBScript
oSO.Value(nDictionary subsript as Long, nIndex subscript as Long) as String
Type
Arguments
nDictionary
The index of the dictionary in the setup object, where 0 is the first dictionary.
nIndex
The index of the entry in the dictionary, where 0 is the first entry.
VBScript example
This example sets the key value of the seventh entry in the first dictionary to 123.
oSO.Value(0,6) = "123"
Word property
The Word property sets or gets the word value in a dictionary term in the setup
DCO file. You can use this property to pass a value to a variable.
VBScript restriction: Because extended properties are not supported through the
C# .NET Interop interface, you must instead use set_Word or get_Word.
The following sample setup DCO XML file defines one dictionary with four words,
where RoutingInstructions is the dictionary name. The text in each set of
quotation marks is the key value that is associated with the word that follows it.
Datacap uses the key value to identify words in the dictionary that are displayed
to an operator during a verification task. Datacap populates the associated field
with the word that the operator selects.
Syntax
VBScript
oSO.Word(nDictionary as Long, nIndex as Long) as String
Type
Arguments
nDictionary
The index of the dictionary within the Setup object, where 0 is the first
dictionary.
nIndex
The index of the entry within the dictionary, where 0 is the first entry.
VBScript example
This example compares the value of the VendorName field to the seventh entry in
the first dictionary in the Setup DCO file:
oSO.Word(0,6) = "FreightLiners"
If VendorName = oSO.Word(0,6) then...
DCOSetup methods
DCOSetup methods enable access to DCO nodes and dictionaries. You can use
DCOSetup methods to obtain and modify metadata, including names, values,
terms, and quantities. You can also use these methods to create or delete nodes.
AddNode method
The AddNode method adds a node to the Setup DCO object at the end of the section
for the type specified (batch, document, page, field, character).
Syntax
VBScript
oSO.AddNode (Type as Long, Name as String) as Boolean
C#
bool AddNode(int nType, string lpszNodeName)
Arguments
nType
Specify one of the following number values to indicate the type of node to
add:
0 = Batch
Returns
C# example
The new node inherits its attributes and variables from the object template in the
file C:\Datacap\dcshared\dcotemp.xml. The resulting Setup object is shown in this
sample:
<D type="NewDocNode">
<V n="ID">0</V>
<V n="TYPE">Document</V>
<V n="STATUS">0</V>
<V n="DOC DATA">0</V>
<V n="MIN_TYPES">0</V>
<V n="MAX_TYPES">0</V>
</D>
DeleteNode method
The DeleteNode method reads the value of the nIndex argument and deletes the
corresponding node from the Setup DCO.
Syntax
VBScript
oSO.DeleteNode(nType as Long, nIndex subscript as Long) as Boolean
C#
bool DeleteNode(int nType, int nIndex)
Arguments
nType
The type of the node to delete:
0 = Batch
1 = Document
2 = Page
3 = Field
4 = Character
nIndex
The index of the node to delete, where 0 is the first node of the specified type.
C# example
The following example deletes the third document node (type = 1, index = 2) from
the Setup DCO:
m_oDCOSetup.DeleteNode(1, 2);
DeleteNodeByName Method
The DeleteNodeByName method deletes a node from the Setup DCO by referencing
the node's name.
Description
DeleteNodeByName references a node through the node's name, and deletes the
node.
Syntax
VBScript
oSO.DeleteNode(nType as Long, lpszName as String) as Boolean
C#
bool DeleteNodeByName(int nType, string lpszName)
Arguments
nType
The type of the node to delete:
0 = Batch
1 = Document
2 = Page
3 = Field
4 = Character
lpszName
The name of the node to delete, as referenced in the node's type attribute:
<D type="NewDocNode">
Returns
VBScript Example
Dim OK
OK = oSO.DeleteNodeByName(3, "Total")
msgbox OK
msgbox "The number of fields remaining is " & oSO.NumOfNodes(3)
C# Example
The following example deletes the document node, "NewDocNode," from the
Setup DCO:
m_oDCOSetup.DeleteNode(1, "NewDocNode");
get_DictionaryName method
The get_DictionaryName method gets the name of a dictionary from the Setup
DCO.
Syntax
C#
string get_DictionaryName(int nDictionary)
Arguments
nDictionary
The index of the dictionary within the Setup DCO, where 0 is the first
dictionary.
Returns
C# example
This example gets the name of the first dictionary from the Setup DCO file,
APT.XML:
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
string strDictName = m_oDCO.SetupObject().get_DictionaryName(0);
get_Value method
The get_Value method gets the key value of a term in a dictionary from the Setup
DCO.
.NET restriction: For VBScript, use the “Value property” on page 55 instead.
Syntax
C#
string get_Value(int nDictionary, int nIndex)
Arguments
nDictionary
The index of the dictionary within the Setup object, where 0 is the first
dictionary.
C# example
This example gets the key value on the second term in the first dictionary:
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
string strDictValue = m_oDCO.SetupObject().get_Value(0, 1);
get_Word method
The get_Word method gets the word value from a dictionary term.
.NET restriction: For VBScript, use the “Word property” on page 55 instead.
Syntax
C#
string get_Word(int nDictionary, int nIndex)
Arguments
nDictionary
The index of the dictionary within the Setup object, where 0 is the first
dictionary
nIndex
The index of the term within the dictionary, where 0 is the first term
C# example
This example gets the word value on the second term in the first dictionary:
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
string strDictWord = m_oDCO.SetupObject().get_Word(0, 1);
GetNode method
The GetNode method gets an interface to a SetupNode object in the Setup DCO by
using an index value. You can use this method when you know the position of the
object but not the name.
Syntax
VBScript
oSO.GetNode(nType as Long, nIndex as Long) child node as node object
C#
TDCOLib.DCOSetupNode GetNode(int nType, int nIndex)
Returns
C# example
The following example gets an interface to the first node of type page from the
Setup DCO:
m_oDCOSetupNode = m_oDCOSetup.GetNode(2, 0);
GetNodeByName method
The GetNodeByName method accesses a SetupNode object from the Setup DCO by
using the object name.
Syntax
VBScript
oSO.GetNodeByName(nType as Long, lpszName as String) as child node as node object
C#
TDCOLib.DCOSetupNode GetNodeByName(int nType, string lpszName)
Arguments
nType
Value indicating the component type:
0 = Batch
1 = Document
2 = Page
3 = Field
lpszName
The node's name, as referenced in the node's type attribute:
<P type="Main_Page">
Returns
The following example gets an interface to the node "Main_Page" of type "page"
from the Setup DCO:
m_oDCOSetupNode = m_oDCOSetup.GetNodeByName(2, "Main_Page");
See also
NumOfDictionaries method
The NumOfDictionaries method returns the number of dictionaries that are defined
in the Setup DCO.
<DICT n="RoutingInstructions">
<W v="None">None</W>
<W v="Delete">Delete</W>
<W v="Rescan">Rescan</W>
<W v="Review">Review</W>
</Dict>
Syntax
VBScript
oSO.NumOfDictionaries( ) as Long
C#
int NumOfDictionaries()
Arguments
None
Returns
See also
NumOfNodes method
The NumOfNodes method gets the number of documents, pages, fields, or character
nodes in the Setup DCO.
Syntax
VBScript
oSO.NumOfNodes(nType as Long) as Long
C#
int NumOfNodes(int nType)
Arguments
nType
Value indicating the object type:
Returns
VBScript Example
This example reads the Setup DCO and gets the number of field nodes:
Dim Flds
Call oSO.ReadSetup("C:\Datacap\APT\dco_APT\APT.xml")
nFlds = oSO.NumOfNodes(3)
msgbox nFlds
C#
This example reads the Setup DCO and gets the number of field nodes:
m_oDCO.ReadSetup("C:\Datacap\APT\dco_APT\APT.xml");
TDCOLib.DCOSetup m_oDCOSetup = m_oDCO.SetupObject();
int numNodes = m_oDCOSetup.NumOfNodes(3);
See also
NumOfWords
The NumOfWords method returns the number of words that are defined in the
dictionary in the Setup DCO.
Description
The following example defines one dictionary with four words, where
RoutingInstructions is the dictionary name, and the text in each set of quotation
marks is the key value that is associated with the word that follows it.
<DICT n="RoutingInstructions">
<W v="None">None</W>
<W v="Delete">Delete</W>
<W v="Rescan">Rescan</W>
<W v="Review">Review</W>
</DICT>
Syntax
VBScript
oSO.NumOfWords (nDictionary subscript as Long) as Long
C#
int NumOfWords(int nDictionary)
Returns
See also
NumOfDictionaries
ReadLock
The ReadLock method locks, and prevents other applications from writing to, the
specified Setup DCO file.
Description
ReadLock attempts to obtain the lock every 50 milliseconds. After 300 unsuccessful
attempts, ReadLock stops the attempt and returns False. The attempt fails when
another process locked the file.
Syntax
C#
bool ReadLock(string lpszPath)
Arguments
lpszPath
Full path and file name to the Setup DCO file.
Returns
See also
UnlockIt
ReadSetup
This method is identical to DCO.ReadSetup, except that you call it from a
DCOSetup object.
set_DictionaryName method
The set_DictionaryName method sets the name of a dictionary within the Setup
DCO.
Syntax
C#
void set_DictionaryName(int nDictionary, string pVal)
Returns
Nothing.
C# example
This C# example sets the name of the first dictionary in the Setup DCO file
APT.XML:
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
string strDictName = m_oDCO.SetupObject().set_DictionaryName(0, "Datacap");
m_oDCO.WriteSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
set_Value method
The set_Value method sets the key value in a dictionary term.
The following example defines one dictionary with four words, where
RoutingInstructions is the dictionary name. The text in each set of quotation
marks is the key value that is associated with the word that follows it.
<DICT n="RoutingInstructions">
<W v="None">None</W>
<W v="Delete">Delete</W>
<W v="Rescan">Rescan</W>
<W v="Review">Review</W>
</DICT>
Syntax
C#
void set_Value(int nDictionary, int nIndex, string pVal)
Arguments
nDictionary
The index of the dictionary within the Setup object, where 0 is the first
dictionary.
nIndex
The index of the term within the dictionary, where 0 is the first term.
pVal
The key value.
Returns
Nothing
This example sets the key value on the second term in the first dictionary to
Delete:
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
m_oDCO.SetupObject().set_Value(0, 1, "Delete");
m_oDCO.WriteSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
set_Word method
The set_Word method sets the word value in a dictionary term.
The following example defines one dictionary with four words, where
RoutingInstructions is the dictionary name. The text in each set of quotation
marks is the key value that is associated with the word that follows it.
<DICT n="RoutingInstructions">
<W v="None">None</W>
<W v="Delete">Delete</W>
<W v="Rescan">Rescan</W>
<W v="Review">Review</W>
</DICT>
Syntax
C#
void set_Word(int nDictionary, int nIndex, string pVal)
Arguments
nDictionary
The index of the dictionary within the Setup object, where 0 is the first
dictionary.
nIndex
The index of the term within the dictionary, where 0 is the first term.
pVal
The key value.
C# example
This example sets the word value on the second term in the first dictionary to
Delete:
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
m_oDCO.SetupObject().set_Word(0, 1, "Delete");
m_oDCO.WriteSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
ShowSetupDialog
The ShowSetupDialog method is identical to DCO.ShowSetupDialog, except that
you call it from a DCOSetup object.
UnlockIt
The Unlockit method unlocks the Setup DCO file that was locked previously with
the ReadLock method.
C#
bool UnlockIt()
Arguments
None
Returns
See also
ReadLock
WriteSetup method
The WriteSetup method is identical to DCO.WriteSetup, except that you call it from
a DCOSetup object.
DCOSetupNode APIs
You can use the DCOSetupNode API properties and methods to access and modify
Setup DCO child objects, including rules and variables.
Each runtime DCO object inherits attributes and variables from the corresponding
DCOSetupNode object. For example, as demonstrated in the following setup node
sample, all documents that are identified as Invoice documents include the TYPE,
STATUS, DOC DATA, MIN_TYPES, MAX_TYPES, and rules variables. The Invoice
document object must also contain at least one Main_Page page object. Similarly, all
runtime objects that are identified as Main_Page types must be in the first position
of the Invoice document.
<D type="Invoice"> 1
<V n="ID">0</V>
<V n="TYPE">Document</V>
<V n="STATUS">0</V>
<V n="DOC DATA">0</V>
<V n="MIN_TYPES">0</V> 2
<V n="MAX_TYPES">0</V>
<V n="rules"><in><r id="1" rs="11"
/><r id="5" rs="7" /><r
id="4" rs="16" /></in></V>
</D>
2 Variables
3 Parameters
The SetupNode object also defines the document integrity rules for that object type.
The following example specifies that a Tax Return document must have at least
one (min="1") and at most one (max="1") page of type 1040EZ. The relative position
attribute (pos="2") specifies that the 1040EZ page must come after the TaxSep page
(if present) and before the Attachment page (if present):
<D type="Tax Return">
<V n="ID">0</V>
<V n="ID">0</V>
<V n="TYPE">Document</V>
<V n="STATUS">0</V>
<V n="DOC DATA">0</V>
<V n="MIN_TYPES">2</V>
<V n="MAX_TYPES">0</V>
<V n="rules"></V>
<P type="TaxSep" pos="1" min="0" max="1"/>
<P type="1040EZ" pos="2" min="1" max="1"/> <--- Rule for page 1040EZ
<P type="Attachment" pos="3" min="0" max="0"/>
</D>
The max="0" value means unlimited. In the example, there can be any number of
attachment pages. The MIN_TYPES and MAX_TYPES variables define the minimum and
maximum number of child object types that must be present at run time to
constitute a valid document. The MIN_TYPES value (2) specifies that each runtime
document must have at least two different page types.
After you obtain an interface to the DCOSetup object, you can obtain an interface
to any DCOSetupNode object by using the “GetNode method” on page 60 or the
“GetNodeByName method” on page 61, as shown in the following example:
TDCOLib.DCOSetupNode m_oDCOSetupNode = m_oDCOSetup.GetNodeByName(2, "Main_Page");
Through the DCOSetup object interface, you can access all of the DCOSetupNode
object properties and methods.
DCOSetupNode properties
You can use DCOSetupNode properties to access DCOSetup objects and modify
metadata, including names, types, and values. You can also use these properties to
modify rules, variables, and child objects.
Name property
The Name property sets or gets the name of the SetupNode object.
The SetupNode object name is saved as the type attribute in the Setup DCO XML
file:
<D type="NodeName">
The name is the identifier that is used to refer to child objects within the Setup
DCO, as shown in this example:
<P type="Main_Page">
.
.
.
<F type="Vendor" pos="0" min="0" max="0"/> <--Referencing the Vendor node by name
Type
VBScript example
In the following example, the code populates a setup object from the BDOcs.xml
setup DCO file. The code then uses the Name property to update the name of the
second node of type Page to Invoice in the Setup object. The example also writes
the updated Setup DCO file to disk.
Call oSO.ReadSetup("c:\Datacap\BDOcs\dco_BDOcs\BDOcs.xml")
Dim objInvPage
Set objInvPage = oSO.GetNode(2,1)
objInvPage.Name = "Invoice"
Call oSO.WriteSetup("c:\Datacap\BDOcs\dco_BDOcs\BDOcs.xml")
C# example
In the following example, after the code populates a setup object from the APT.XML
setup DCO file, the code uses the Name property to update the name of the
TM000001 node to Invoice in the Setup object. The example also writes the updated
Setup DCO file to disk.
m_oDCO.ReadSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
TDCOLib.DCOSetupNode m_oDCOSetupNode = m_oDCO.FindChild("TM000001").SetupNode();
m_oDCOSetupNode.Name = "Invoice";
m_oDCO.WriteSetup("C:\\Datacap\\APT\\dco_APT\\APT.XML");
ObjectType property
The ObjectType property sets or gets the SetupNode object type, such as a batch,
document, page, field, or character.
Use one of these number values to determine the SetupNode object type:
Object type
0 = Batch.
1 = Document.
2 = Page.
3 = Field.
4 = Character.
Syntax
VBScript
oSNO.ObjectType as Long
C#
int ObjectType { set; get; }
VBScript example
This example gets a SetupNode object for the Total field and sends the type (3 =
Field) to a script debugger:
Dim objTotal
Set objTotal = oSO.GetNodeByName(3, "Total")
Debug.write objTotal.ObjectType
RuleChildName
The RuleChildName property sets or gets the name of a rule that is referenced by an
index.
Description
Important: VBScript only. Extended properties are not supported through the C#
.NET Interop interface. Instead, use set_RuleChildName or get_RuleChildName.
Syntax
VBScript
oSNO.RuleChildName(nIndex as Long) as String
Arguments
nIndex
The index of the rule, where 0 is the first rule.
Type
Example
VBScript
Dim objDoc
Set objDoc = MQDCO.GetNodebyName(1, "Doc")
Call objDoc.AddRule (2,"Page1",1,1,3)
msgbox "The name of Rule 1 is " & objDoc.RuleChildName(0)
See also
AddRule
RuleMaxNum
The RuleMaxNum property sets or gets the max attribute for a rule.
Description
Important: VBScript only. Extended properties are not supported through the C#
.NET Interop interface. Instead, use set_RuleMaxNumber or get_RuleMaxNumber.
Arguments
RuleIndex
The index of the rule, where 0 is the first rule under this SetupNode object.
Type
Example
VBScript
Dim MaxTotal
MaxTotal = objInv.RuleMaxNum(3)
msgbox MaxTotal
See also
RuleMinNum
RuleMinNum
The RuleMinNum property sets or gets the min attribute for a rule.
Description
Important: VBScript only. Extended properties are not supported through the C#
.NET Interop interface. Instead, use set_RuleMinNumber or get_RuleMinNumber.
Syntax
VBScript
oSNO.RuleMinNum (RuleIndex as Long) as Long
Arguments
RuleIndex
The index of the rule, where 0 is the first rule under this SetupNode object.
Type
Example
VBScript
Dim MinSSN
MinSSN = objPageTwo.RuleMinNum(0)
msgbox MinSSN
See also
RuleMaxNum
Description
Important: VBScript only. Extended properties are not supported through the C#
.NET Interop interface. Instead, use set_RuleObjectType or get_ RuleObjectType.
0 = Batch
1 = Document
2 = Page
3 = Field
Syntax
VBScript
oSNO.RuleObjectType (Index as Long) as Long
Arguments
Index
The index of the rule, where 0 is the first rule under this SetupNode object.
Type
Example
VBScript
Dim TypeSSN
TypeSSN = objPageTwo.RuleObjType(0)
msgbox TypeSSN
See also
get_ RuleObjectType
RulePosition
The RulePosition property determines the order of rules, and optionally restricts
the order of child objects within a parent object at run time.
Description
Important: VBScript only. Extended properties are not supported through the C#
.NET Interop interface. Instead, use set_RulePosition or get_ RulePosition.
All child objects with rules that specify Position=1 must appear before any child
objects with higher position values (greater than 1). A Position=0 means that the
child item can appear in any order.
Type
Arguments
Index
The index of the rule, where 0 is the first rule under this SetupNode object.
Variable
The Variable property sets or gets the value that is associated with a variable in
the SetupNode object. You can use this property to identify objects (for example,
pages) that require special processing when a variable contains a specific value.
Description
Important: VBScript only. Extended properties are not supported through the C#
.NET Interop interface. Instead, use set_Variable or get_ Variable.
Syntax
VBScript
oSNO.Variable (VarName as String) as Variant
Type
Arguments
VarName
Name of the variable (case sensitive)
Example
VBScript
Call objTotal.AddVariable ("Length", "10")
msgbox objTotal.Variable("Length")
See also
get_ Variable
VariableName
The VariableName property sets or gets the name of a variable that is accessed by
an index in the DCOSetupNode object. You can use this property to identify
objects (for example, pages) that require special processing when a variable
contains a specific value. This property is useful when a node contains many child
objects and variables.
Description
Important: VBScript only. Extended properties are not supported through the C#
.NET Interop interface. Instead, use set_VariableName or get_ VariableName.
Type
Arguments
Node
The index of the variable, where 0 is the first variable that is defined in the
DCOSetupNode object.
See also
get_ VariableName
VariableValue
The VariableValue property sets or gets the value of an indexed variable from the
DCOSetupNode object. You can use this property to identify objects (for example,
pages) when a node contains many child objects and variables.
Description
Important: VBScript only. Extended properties are not supported through the C#
.NET Interop interface. Instead, use set_RuleObjectType or get_ RuleObjectType.
Syntax
VBScript
oSNO.VariableValue (Node as Long) as Variant
Arguments
Node
The index of the variable, where 0 is the first variable that is defined in the
DCOSetupNode object.
Data type
Variant
Example
VBScript
This example displays the current value that is assigned to the third
variable that is linked to the objTotal node:
msgbox objTotal.VariableValue(2)
read/write
See also
get_ RuleObjectType
AddRule method
The AddRule method adds a document integrity rule to a SetupNode object. For
example, you can use this method to add a rule that specifies that a document type
must contain a specific page type.
Document integrity rules specify the required structure of the document. For
example, a rule for the document type Invoice might specify that documents of
this type must have a page of type Main_Page. A rule for the page type Main_Page
might specify that pages of this type must have a field of type Invoice_Total.
If a SetupNode object for the specified child object does not exist, this method
creates the SetupNode object.
Syntax
VBScript
AddRule(ObjectType as Long, lpszChildName as String,
nPosition as Long, MinNumber as Long, MaxNumber as Long)
as Boolean
C#
int AddRule(int nObjectType, string lpszChildName,
short nPosition, short nMinNumber, short nMaxNumber)
Arguments
nObjectType
Use one of the following number values to determine the object type of the
child node:
0 = Batch
1 = Document
2 = Page
3 = Field
lpszChildName
The name of the child object, which is stored as the type attribute of the rule.
nPosition
The position that child objects of this type must be relative to other child
items at run time. In the DCO Setup window, this value is the Order property
of the child node.
nMinNumber
The minimum number of instances of this child object that must exist for the
document structure to be valid.
nMaxNumber
The maximum number of instances of this child object that can exist for the
document structure to be valid.
C# example
This example gets the SetupNode object for the Invoice document in the Setup
DCO. The example then adds a rule that requires one instance of the page NewPage
to exist for the document structure to be valid. If a page node for NewPage does not
exist, the method creates NewPage automatically.
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.AddRule(2, "NewPage", 0, 1, 1);
Additionally, if NewPage does not exist, the following page node is created:
<P type="NewPage">
<V n="ID">0</V>
<V n="TYPE">Page</V>
<V n="STATUS">0</V>
<V n="IMAGEFILE"></V>
<V n="DATAFILE"></V>
<V n="TEMPLATE IMAGE"></V>
<V n="MIN_TYPES">0</V>
<V n="MAX_TYPES">0</V>
</P>
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
Arguments
lpszName
Name of the new variable.
Returns
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");
DeleteRule method
The DeleteRule method deletes the specified document integrity rule from a
SetupNode object.
Description
For a description of document integrity rules, see “AddRule method” on page 75.
Syntax
VBScript
oSNO.DeleteRule(nIndex as Long) as Boolean
C#
bool DeleteRule(int nIndex)
Arguments
nIndex
The index of the rule to delete, where 0 is the first rule that is specified under
this SetupNode object.
Returns
See also
DeleteVariable method
The DeleteVariable method deletes the specified variable that is referenced by an
index, from a setup node.
Applies to
Arguments
VarIndex
The index of the variable to delete, where 0 is the first variable.
Returns
See also
DeleteVariableByName method
The DeleteVariableByName method deletes the specified variable that is referenced
by name from a setup node.
Syntax
VBScript
oSNO.DeleteVariableByName(lpszName as String) as Boolean
C#
bool DeleteVariableByName(string lpszName)
Applies to
Arguments
lpszName
The variable name
Returns
See also
FindRule method
The FindRule method uses a specified name to search for a SetupNode child object.
Arguments
lpszName
The name of the rule.
Returns
Applies to
See also
get_RuleChildName method
The get_RuleChildName method gets the name of the rule under the current
SetupNode object.
Description
The name of the rule is the type attribute in the Setup DCO XML file, and is the
same name as the child node to which the rule applies. In the following rule for
documents of type Invoice, the name of the rule is Main_Page.
<D type="Invoice">
.
.
<P type="Main_Page" pos="0" min="1" max="1"/> <!--Rule-->
Syntax
C#
string get_RuleChildName(int nIndex)
Arguments
nIndex
The index of the rule, where 0 is the first rule under this SetupNode object.
C# Example
This example gets the name of the first rule under the current SetupNode object:
string strRuleName = m_oDCOSetupNode.get_RuleChildName(0);
“set_RuleChildName” on page 87
get_RuleMaxNumber Method
The get_RuleMaxNumber method gets the maximum number of child objects of the
specified type that can be associated with the parent object without violating a
document integrity rule.
Attention: .NET only. For VBScript, use the “RuleMaxNum” on page 70 property
instead.
Description
The maximum number is the max attribute in the Setup DCO XML file. In the
following rule, the maximum number of pages of type Main_Page that a document
of type Invoice can have is 1.
<D type="Invoice">
.
.
<P type="Main_Page" pos="0" min="1" max="1"/> <!--Rule-->
Syntax
C#
int get_RuleMaxNumber(int nIndex)
Arguments
nIndex
The index of the rule, where 0 is the first rule under the current SetupNode
object.
C# Example
This example gets the max attribute of the first rule under the current SetupNode
object:
int nMaxNum = m_oDCOSetupNode.get_RuleMaxNumber(0);
See also
“set_RuleMaxNumber” on page 88
get_RuleMinNumber method
The get_RuleMinNumber method gets the minimum number of child objects of the
specified type that must be associated with the parent object to avoid violating a
document integrity rule.
Attention: .NET only. For VBScript, use the “RuleMinNum” on page 71 property
instead.
Description
The minimum number is the min attribute in the Setup DCO XML file. In the
following rule, the minimum number of pages of type Main_Page that a document
of type Invoice must have is 1.
Syntax
C#
int get_RuleMinNumber(int nIndex)
Arguments
nIndex
The index of the rule index, where 0 is the first rule under the current
SetupNode object.
C# example
This example gets the min attribute of the first rule under the current SetupNode
object.
int nMinNum = m_oDCOSetupNode.get_RuleMinNumber(0);
See also
“set_RuleMinNumber” on page 88
get_RuleObjectType method
The get_RuleObjectType method gets the type of an object.
Description
0 = Batch
1 = Document
2 = Page
3 = Field
In the following rule for documents of type Invoice, the object type is 2 (Page).
<D type="Invoice">
.
.
<P type="Main_Page" pos="0" min="1" max="1"/> <!--Rule-->
Syntax
C#
int get_RuleObjectType(int nIndex)
C# Example
This example gets the object type for the first rule under the current SetupNode
object.
int nRuleType = m_oDCOSetupNode.get_RuleObjectType(0);
See also
“set_RuleObjectType” on page 88
get_RulePosition method
The get_RulePosition method gets the pos attribute of a specified rule within a
SetupNode object. The pos attribute determines the position of an object type
relative to other objects of the same type within the parent node. You can use this
method to verify the order of pages in a document and ensure document integrity.
Attention: .NET only. For VBScript, use the “RulePosition” on page 72 property
instead.
Description
The following rules specify position requirements for documents of type Tax
Return.
v A TaxSep page must come before the 1040EZ page and any Attachment pages.
v The 1040EZ page must come before any Attachment pages.
<D type="Tax Return">
.
.
<P type="TaxSep" pos="1" min="0" max="1"/> <!--Rule 0-->
<P type="1040EZ" pos="2" min="1" max="1"/> <!--Rule 1-->
<P type="Attachment" pos="3" min="0" max="0"/> <!--Rule 2-->
If a rule has pos="0", then the corresponding object type is not included in the
process that confirms document integrity. For details about document integrity, see
“DCOSetupNode APIs” on page 67.
Syntax
C#
int get_RulePosition(int nIndex)
Arguments
nIndex
The index of the rule, where 0 is the first rule under the current SetupNode
object.
C# Example
This example gets the position attribute for the first rule under the current
SetupNode object.
See also
“set_RulePosition” on page 89
get_Variable method
The get_Variable method gets the value of a variable from the SetupNode object.
You can use this method to identify objects (for example, pages) that require
special processing when a variable contains a specific value.
Description
The following example shows three variables that are associated with the page
node Main_Page in the Setup DCO file.
<P type="Main_Page">
<V n="ID">0</V> 0
<V n="TYPE">Page</V> 1
<V n="STATUS">0</V> 2
Syntax
C#
string get_Variable(string lpszName)
Arguments
lpszName
The variable name (case sensitive)
C# Example
The following example gets the value of the variable TYPE from the page node
Main_Page in the Setup DCO.
TDCOLib.DCOSetupNode m_oDCOSetupNode = m_oDCOSetup.GetNodeByName(2, "Main_Page");
string strValue = m_oDCOSetupNode.get_Variable("TYPE");
See also
get_VariableName method
The get_VariableName method gets the name of an indexed variable from the
SetupNode object. You can use this method to identify objects (for example, pages)
that require special processing when a variable contains a specific value. This
method is useful when a node contains many child objects and variables.
Description
The following example shows three variables that are associated with the page
node Main_Page in the Setup DCO file:
<P type="Main_Page">
<V n="ID">0</V> 0
<V n="TYPE">Page</V> 1
<V n="STATUS">0</V> 2
Syntax
C#
string get_VariableName(int nIndex)
Arguments
nIndex
The index of the variable, where 0 is the first variable that is defined in the
SetupNode object
C# Example
The following example gets the name of the first variable that is defined within the
page node, Main_Page, in the Setup DCO.
TDCOLib.DCOSetupNode m_oDCOSetupNode = m_oDCOSetup.GetNodeByName(2, "Main_Page");
string varName = m_oDCOSetupNode.get_VariableName(0);
See also
get_VariableValue Method
The get_VariableValue method gets the value of an indexed variable from the
SetupNode object. You can use this method to identify objects (for example, pages)
that require special processing when a variable contains a specific value. This
method is useful when a node contains many child objects and variables.
Attention: .NET only. For VBScript, use the “VariableValue” on page 74 property
instead.
Description
The following example shows three variables that are associated with the page
node, Main_Page, in the Setup DCO file:
Syntax
C#
string get_VariableValue(int nIndex)
Arguments
nIndex
The index of the variable, where 0 is the first variable defined in the
SetupNode object
C# Example
The following example gets the value of the first variable defined with the page
node, Main_Page, in the Setup DCO:
TDCOLib.DCOSetupNode m_oDCOSetupNode = m_oDCOSetup.GetNodeByName(2, "Main_Page");
string varValue = m_oDCOSetupNode.get_VariableValue(0);
See also
GetRule method
The GetRule method gets the SetupNode object that is referenced by a specified
rule. You can use this method to identify objects (for example, pages) that require
special processing when a node contains many child objects and rules.
Description
For example, the following rule references a page of type Main_Page. So, GetRule
returns the Main_Page SetupNode object.
<D type="Invoice">
.
.
<P type="Main_Page" pos="0" min="1" max="1"/> <!--Rule referencing page "Main_Page" -->
Syntax
VBScript
oSNO.GetRule(nIndex as Long) child node as node object
C#
TDCOLib.DCOSetupNode GetRule(int nIndex)
Arguments
nIndex
The index of the rule, where 0 is the first rule under this SetupNode object.
Returns
C# Example
This example gets the SetupNode object for the Invoice document in the Setup
DCO and then gets the first rule under this node. It then gets the SetupNode object
for the child object that is referenced by this rule.
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");
TDCOLib.DCOSetupNode m_oDCOSetupNode2 = m_oDCOSetupNode.GetRule(0);
See also
NumOfRules method
The NumOfRules method returns the number of rules that is within a SetupNode
object.
Syntax
VBScript
oSNO.NumOfRules( ) as Long
C#
int NumOfRules()
Arguments
None
Returns
Applies to
C# Example
This example returns the number of rules that is contained in the current
SetupNode object.
int nNumRules = m_oDCOSetupNode.NumOfRules();
See also
Description
This method returns user-defined variables and standard variables. (For more
information, see the Standard Variable Reference).
Syntax
VBScript
oSNO.NumOfVariables ( ) as Long
C#
int NumOfVariables()
Arguments
None
Returns
C# Example
The following example returns the number of rules within the current SetupNode
object:
int nNumVars = m_oDCOSetupNode.NumOfVariables();
set_RuleChildName
The set_RuleChildName method sets the name of the rule under the current
SetupNode object.
Description
Important: .NET only. For VBScript, use the RuleChildName property instead.
Syntax
C#
void set_RuleChildName(int nIndex, string pVal)
Arguments
nIndex
The index of the rule, where 0 is the first rule under this SetupNode object.
See also
get_RuleChildName
Description
Important: .NET only. For VBScript, use the RuleMaxNum property instead.
Syntax
C#
void set_RuleMaxNumber(int nIndex, int pVal)
Arguments
nIndex
The index of the rule, where 0 is the first rule under this SetupNode object.
pVal
The maximum number of child objects.
See also
get_RuleMaxNumber
set_RuleMinNumber
The set_RuleMinNumber method sets the minimum number of child objects of the
specified type that must be associated with the parent object to avoid violating a
document integrity rule.
Description
Important: .NET only. For VBScript, use the RuleMinNum property instead.
Syntax
C#
void set_RuleMinNumber(int nIndex, int pVal)
Arguments
nIndex
The index of the rule, where 0 is the first rule under the current SetupNode
object.
pVal
The minimum number of child objects.
See also
get_RuleMinNumber
set_RuleObjectType
The set_RuleObjectType method sets the type of an object.
Important: .NET only. For VBScript, use the RuleObjectType property instead.
Syntax
C#
void set_RuleObjectType(int nIndex, int pVal)
Arguments
nIndex
The index of the rule, where 0 is the first rule under this SetupNode object.
pVal
The object type:
0 = Batch
1 = Document
2 = Page
3 = Field
See also
get_RuleObjectType
set_RulePosition
The set_RulePosition method sets the pos attribute of a specified rule within a
SetupNode object. The pos attribute determines the position of an object type
relative to other objects of the same type within the parent node. You can use this
method to determine the order of pages in a document and ensure document
integrity.
Description
Important: .NET only. For VBScript, use the RulePosition property instead.
Syntax
C#
void set_RulePosition(int nIndex, int pVal)
Arguments
nIndex
The index of the rule, where 0 is the first rule under this SetupNode object.
pVal
The position of the rule.
See also
get_RulePosition
Description
Important: .NET only. For VBScript, use the Variable property instead.
Syntax
C#
void set_Variable(string lpszName, string pVal)
Arguments
lpszName
The variable name (case sensitive).
pVal
The value (always a string).
See also
get_Variable
set_VariableName
The set_VariableName method sets the name of an indexed variable within a
SetupNode object. You can use this method to identify variables within a node that
contains many child objects.
Description
Important: .NET only. For VBScript, use the VariableName property instead.
Syntax
C#
void set_VariableName(int nIndex, string pVal)
Arguments
nIndex
The index of the variable, where 0 is the first variable that is defined in the
SetupNode object.
pVal
The variable name.
See also
get_VariableName
Description
Important: .NET only. For VBScript, use the VariableValue property instead.
Syntax
C#
void set_VariableValue(int nIndex, string pVal)
Arguments
nIndex
The index of the variable, where 0 is the first variable that is defined in the
SetupNode object.
pVal
The variable value (always a string).
See also
get_VariableValue
IBM may not offer the products, services, or features discussed in this document in
other countries. Consult your local IBM representative for information on the
products and services currently available in your area. Any reference to an IBM
product, program, or service is not intended to state or imply that only that IBM
product, program, or service may be used. Any functionally equivalent product,
program, or service that does not infringe any IBM intellectual property right may
be used instead. However, it is the user's responsibility to evaluate and verify the
operation of any non-IBM product, program, or service.
IBM may have patents or pending patent applications covering subject matter
described in this document. The furnishing of this document does not grant you
any license to these patents. You can send license inquiries, in writing, to:
For license inquiries regarding double-byte (DBCS) information, contact the IBM
Intellectual Property Department in your country or send inquiries, in writing, to:
The following paragraph does not apply to the United Kingdom or any other
country where such provisions are inconsistent with local law:
INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS
PUBLICATION “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS
FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or
implied warranties in certain transactions, therefore, this statement may not apply
to you.
Any references in this information to non-IBM Web sites are provided for
convenience only and do not in any manner serve as an endorsement of those Web
sites. The materials at those Web sites are not part of the materials for this IBM
product and use of those Web sites is at your own risk.
Licensees of this program who wish to have information about it for the purpose
of enabling: (i) the exchange of information between independently created
programs and other programs (including this one) and (ii) the mutual use of the
information which has been exchanged, should contact:
IBM Corporation
J46A/G4
555 Bailey Avenue
San Jose, CA 95141-1003
U.S.A.
The licensed program described in this document and all licensed material
available for it are provided by IBM under terms of the IBM Customer Agreement,
IBM International Program License Agreement or any equivalent agreement
between us.
This information contains examples of data and reports used in daily business
operations. To illustrate them as completely as possible, the examples include the
names of individuals, companies, brands, and products. All of these names are
fictitious and any similarity to the names and addresses used by an actual business
enterprise is entirely coincidental.
All statements regarding IBM's future direction or intent are subject to change or
withdrawal without notice, and represent goals and objectives only.
This information contains examples of data and reports used in daily business
operations. To illustrate them as completely as possible, the examples include the
names of individuals, companies, brands, and products. All of these names are
fictitious and any similarity to the names and addresses used by an actual business
enterprise is entirely coincidental.
COPYRIGHT LICENSE:
Trademarks
The following terms are trademarks of the International Business Machines
Corporation in the United States, other countries, or both: http://www.ibm.com/
legal/copytrade.shtml
Microsoft, Windows, Windows NT, and the Windows logo are trademarks of
Microsoft Corporation in the United States, other countries, or both.
Java and all Java-based trademarks and logos are trademarks or registered
trademarks of Oracle and/or its affiliates.
Adobe, the Adobe logo, PostScript, and the PostScript logo are either registered
trademarks or trademarks of Adobe Systems Incorporated in the United States,
and/or other countries.
UNIX is a registered trademark of The Open Group in the United States and other
countries.
Other product and service names might be trademarks of IBM or other companies.
The Software Offering uses session and persistent cookies that collect each user's
user name, for purposes of session management, enhanced user usability, single
sign-on configuration. Session cookies cannot be disabled. Persistent cookies can be
disabled, but disabling them will also eliminate the functionality they enable.
If the configurations deployed for this Software Offering provide you as customer
the ability to collect personally identifiable information from end users via cookies
and other technologies, you should seek your own legal advice about any laws
applicable to such data collection, including any requirements for notice and
consent.
For more information about the use of various technologies, including cookies, for
these purposes, See IBM’s Privacy Policy at http://www.ibm.com/privacy and
IBM’s Online Privacy Statement at http://www.ibm.com/privacy/details the
Notices 95
section entitled “Cookies, Web Beacons and Other Technologies” and the “IBM
Software Products and Software-as-a-Service Privacy Statement” at
http://www.ibm.com/software/info/product-privacy.
Index 99
set_CharConfidence setting primary character data Setup DCO (continued)
DCO methods 47 DCO properties 11 getting number of variables
set_CharValue Text 11 DCOSetupNode methods 87
DCO methods 48 setting runtime field position NumOfVariables 87
set_DictionaryName DCO methods 43 getting number of words
DCOSetup methods 64 SetPosition 43 DCOSetup methods 63
set_OMRValue setting Status property NumOfWords 63
DCO methods 49 DCO properties 11 getting object types
set_RuleChildName Status 11 DCOSetupNode methods 81
DCOSetupNode methods 87 setting variable get_RuleObjectType 81
set_RuleMaxNumber DCO properties 12 getting path
DCOSetupNode methods 88 Variable 12 DCOSetup properties 54
set_RuleMinNumber setting XML file name Path 54
DCOSetupNode methods 88 DCO properties 13 getting rule name
set_RuleObjectType XML 13 DCOSetupNode methods 79
DCOSetupNode methods 89 Setup DCO get_RuleChildName 79
set_RulePosition adding nodes getting rule pos attribute
DCOSetupNode methods 89 AddNode 56 DCOSetupNode methods 82
set_Value DCOSetup methods 56 document integrity 82
DCOSetup methods 65 adding rules get_RuleObjectType 82
set_Variable AddRule 75 verifying page order in
DCO methods 49 DCOSetupNode methods 75 documents 82
DCOSetupNode methods 90 adding variables getting SetupNode objects
set_VariableName AddVariable 76 DCOSetupNode methods 85
DCOSetupNode methods 90 DCOSetupNode methods 76 GetRule 85
set_VariableValue deleting rules identifying objects by rules 85
DCOSetupNode methods 91 DCOSetupNode methods 77 getting variable names
set_Word DeleteRule 77 DCOSetupNode properties 73
DCOSetup methods 66 deleting variables identifying objects through index
SetPosition DCOSetupNode methods 78 values 73
DCO methods 43 DeleteVariable 78 VariableName 73
setting alternative character field data DeleteVariableByName 78 getting variable values
AltText 7 getting dictionary name DCOSetupNode methods 83, 84
DCO properties 7 DCOSetup methods 59 DCOSetupNode properties 73
setting character data DCOSetup properties 54 get_Variable 83
DCO methods 46 DictionaryName 54 get_VariableName 84
set_AltTex 46 get_DictionaryName 59 get_VariableValue 84
setting character data confidence value getting dictionary term key value identifying objects through
ConfidenceString 9 DCOSetup properties 55 variable values 73, 83, 84
DCO properties 9 Value 55 Variable 73
setting character data value getting dictionary term key values getting word value
CharValue 8 DCOSetup methods 59 DCOSetup properties 55
DCO properties 8 get_Value 59 Word 55
setting character object position getting dictionary word values searching for child object
DCO methods 43 DCOSetup methods 60 DCOSetupNode methods 79
SetPosition 43 get_Word 60 FindRule 79
setting character value confidence level getting max attribute for child objects setting dictionary key values
CharConfidence 8 DCOSetupNode methods 80 DCOSetup methods 65
DCO properties 8 get_RuleMaxNumber 80 set_Value 65
setting character values getting min attribute for child objects setting dictionary name
DCO methods 48 DCOSetupNode methods 80 DCOSetup methods 64
set_CharValue 48 get_RuleMinNumber 80 set_DictionaryName 64
setting confidence level of characters Getting nodes setting dictionary term key value
AltConfidenceString 6 DCOSetup methods 60 DCOSetup properties 55
DCO properties 6 GetNode 60 Value 55
setting confidence levels Getting nodes by using names setting dictionary word values
DCO methods 47 DCOSetup methods 61 DCOSetup methods 66
set_CharConfidence 47 GetNodeByName 61 set_Word 66
setting image file name getting number of dictionaries setting max attribute for child objects
DCO properties 10 DCOSetup methods 62 DCOSetupNode methods 88
ImageName 10 NumOfDictionaries 62 set_RuleMaxNumber 88
setting object name getting number of nodes setting min attribute for child objects
DCO properties 12 DCOSetup methods 62 DCOSetupNode methods 88
Type 12 NumOfNodes 62 set_RuleMinNumber 88
setting object unique identifier getting number of rules setting object types
DCO properties 10 DCOSetupNode methods 86 DCOSetupNode methods 89
ID 10 NumOfRules 86 set_RuleObjectType 89
Index 101
102 IBM Datacap: DCO API Guide
SC27-6376-00