# Variable Values

After creating templates for each type of document (there can be several: 5, 10, etc.), you can take two paths:

1. Configure the project script to recognize each template sequentially, adding as many blocks to the script as there are templates created.

<figure><img src="https://3212714295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI0zUnKkOuy6lWt7DZ46u%2Fuploads%2Fgit-blob-4f0a7bbe03ca1caee80a88d2fc4040d28961096d%2Fimage%20(223).png?alt=media" alt=""><figcaption></figcaption></figure>

2. Run recognition based on the list of templates in one block.

   Before using the list, it must be defined in Variables. Select "Type" of variable as "List", set the variable name, and edit the variable value:

   1. add the names of the templates we created to the list, which will be used for recognition. For example, "`ТОРГ12.json`", "`УПД.json`", etc.
   2. add the list using the `@` sign in the format `@("file name1","file name2")`, where `"file name1"` and `"file name2"` are needed to specify the set of files to be processed. For example, "`@("ТОРГ12.json","УПД.json")`".

   <figure><img src="https://3212714295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI0zUnKkOuy6lWt7DZ46u%2Fuploads%2Fgit-blob-14fa4bc91065881117742084c5ed3be2933316ca%2Fimage%20(224).png?alt=media" alt=""><figcaption></figcaption></figure>

In the Properties Panel, specify the "File Path\*" in the format `.pdf`.

<figure><img src="https://3212714295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI0zUnKkOuy6lWt7DZ46u%2Fuploads%2Fgit-blob-10958c2e0785e30de96506c1f925322f10d98bf7%2F2025-10-03_19-38-33.png?alt=media" alt=""><figcaption></figcaption></figure>

The file can be multi-page. Files in `.png` and `.jpg` formats are also supported.

Next, specify the "Template File Path\*" for recognition.

<figure><img src="https://3212714295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI0zUnKkOuy6lWt7DZ46u%2Fuploads%2Fgit-blob-79917aeb7954b9f817c7899e6ddcec9be67a2a89%2Fimage%20(226).png?alt=media" alt=""><figcaption></figcaption></figure>

When specifying a list of template files, each file will be used sequentially until recognition is successfully completed. If none of the templates are suitable for the document, an exception will be generated with the error of the first template from the list.

In the "Page Number" field, specify `1`, so recognition will start from the first page of the document.

<figure><img src="https://3212714295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI0zUnKkOuy6lWt7DZ46u%2Fuploads%2Fgit-blob-7a824cdc8d18b72ecb9743acc711e3f9fad1930d%2Fimage%20(227).png?alt=media" alt=""><figcaption></figcaption></figure>

When the "Recognize by Template" block is executed, the document specified in the list on the "Variables" panel will be recognized first.

In case of an error with one of the templates, the Robot will move on to recognize the next template. If the page recognition parameters for the templates are the same, then using the list increases the processing speed of multiple templates. If the recognition parameters differ, the time for document recognition increases.

For example, if one of the templates specifies the OCR module Tesseract, and another template specifies YandexVision (or different scale, or language), then for each of these templates, the Robot will re-recognize the document, as different parameters are specified. Therefore, we recommend keeping the default settings when creating templates for standard documents and only changing them in case of special necessity.

If the settings of some templates have been changed, it is advisable to group them: first specify several templates with one type of settings, then several templates with another type of settings.

### **Template Index**

After recognizing the document, the template index will be determined in the "Template Index" field.

<figure><img src="https://3212714295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI0zUnKkOuy6lWt7DZ46u%2Fuploads%2Fgit-blob-f965c9abbf1c4c6ca2d8535e4dfa3ccb380ae13e%2Fimage%20(228).png?alt=media" alt=""><figcaption></figcaption></figure>

Using the "Condition" block, it is necessary to set the trajectory of the further script according to the obtained indices. (For example, if the index is `0` – then it is UPD, if the index is `1` – Invoice, etc.)

If recognition was performed using a single document, rather than a list, the default index will always be `0` (zero).

### **Attributes**

<figure><img src="https://3212714295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI0zUnKkOuy6lWt7DZ46u%2Fuploads%2Fgit-blob-887ccb47302f6cd21258635fce7fbf4c73d0dc08%2Fimage%20(229).png?alt=media" alt=""><figcaption></figcaption></figure>

After processing the template, you need to continue working with the created Attributes.

Attributes are displayed in the "Full Scan Results" window of the Template Designer (Name, Value).

To get the values of the Attributes, you need to refer to the dictionary and assign the value to a variable. For this, you should use the "Assign Value to Variable" block.

In the properties panel, select the variable value by clicking the `…` button and editing the expression. In the opened window, click on the category $Attributes.

<figure><img src="https://3212714295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI0zUnKkOuy6lWt7DZ46u%2Fuploads%2Fgit-blob-faefc2fe0b3c1716f894f603430254709bd71aa5%2Fimage%20(230).png?alt=media" alt=""><figcaption></figcaption></figure>

Specify the "Name" of the Attribute that was previously set in the Template Designer, using quotes.

Next, you need to specify the name of the variable that will continue to be used. The variable name can be arbitrary, for example, $AttributesZakaz or $MyOrganization.

### **Table**

When assigning a value to a variable for a table (or an array of tables), you need to use the table indices that were automatically assigned in the Template Designer (in order). It is not possible to manually assign a value to a variable.

In the "Properties" panel, select the variable value and click on `…`, then edit the expression. In the opened window, click on the category $Tables.

If necessary, add as many tables as were added in the Template Designer and specify the index for each table.

<figure><img src="https://3212714295-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FI0zUnKkOuy6lWt7DZ46u%2Fuploads%2Fgit-blob-447d815680dabd5cdd31d1b66723db227a6f9783%2Fimage%20(231).png?alt=media" alt=""><figcaption></figcaption></figure>

Next, you need to specify the name of the variable that will continue to be used. The variable name can be arbitrary, for example, $TablesProducts or $MyTables.

![](https://sherparpa.ru/wp-content/uploads/2023/11/image12-1.png)

Once the "Name" and "Value" of the variables have been set, you can proceed with further work.
