> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Object model

> Object model basics for ABBYY FlexiCapture scripts: collection methods, recurring fields and table rows, and how to compose paths to document fields.

Specifics of the used object model are described below.

## Working with collections

All collections in the object model support the following methods:

<table width="100%"><thead><tr><th style={{textAlign: 'left'}}><p><strong>Name</strong></p></th><th style={{textAlign: 'left'}}><p><strong>Type</strong></p></th><th style={{textAlign: 'left'}}><p><strong>Access</strong></p></th><th style={{textAlign: 'left'}}><p><strong>Description</strong></p></th></tr></thead><tbody><tr><td><p>Count</p></td><td><p>int</p></td><td><p>Read-only</p></td><td><p>The number of items in the collection</p></td></tr><tr><td><p>Item( index : int )</p></td><td><p>ItemInterface</p></td><td><p>Read-only</p></td><td><p>Retrieves an item of the collection with the given index.</p><p>Enumeration begins with "0".</p></td></tr></tbody></table>

<Note>
  Instead of using the method Item you can also address items of the collection using parentheses or square brackets depending on the selected language. In **JScript**, **VBScript** and **Visual Basic.Net** languages, parentheses are used. In **C#.Net** it is only possible to use square brackets. In **JScript.Net** both parentheses and square brackets can be used.
</Note>

For example,

```
Items( 1 ).Text = "Hello" or Items[ 1 ].Text = "Hello"
```

All collections can be used in "for each" and similar constructs.

## Working with recurring fields and tables

All document fields except tables can be recurring.

In the document structure recurring fields are represented with a special prototype field which has a nonempty **Items** collection.

A prototype field has neither child items nor value. It is used only for storing the set of the field iterations. Child fields and/or field values can be attributes of the field instances only, which are available through the **Items** method of the [IField](/flexi-capture/appendix/scripts/ifield) object.

Tables always have the **Rows** collection (**Rows** is the synonym of **Items**). The Rows collection contains only those rows of the table whose cells can be accessed through the method **Children** of the rows.

## <a id="pathforming" />Composing paths to fields

Field, HasField and IndexedItemValue methods of the [IDocument](/flexi-capture/appendix/scripts/idocument) object use paths to the fields on the form as their parameters. The formal way to represent the path with a BNF (Backus-Naur Form) is as follows:

\<Path> ::= \<Path\_component> | \<Path> "" \<Path\_component>

\<Path\_component> ::= \<Field\_name> | \<Field\_name> "\["\<Field\_iteration\_number>"]"

Where **Field\_name** indicates the names of the document fields as they are defined in Document Definition and **Field\_iteration\_number** is the iteration number of the recurring field (the row number for tables) beginning from "0".

The path can be full or relative. Full paths are constructed beginning with the name of the document section, while relative paths are constructed beginning with the name of the child item in the group.

For example, to address the third row of the column "Total" in the table "Table", which is located in the section "Section" you should write the following:

```
"Section\Table[2]\Total"
```

Such a full name can be constructed by means of the **FullName** method of the [IField](/flexi-capture/appendix/scripts/ifield) object.
