> ## 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.

# Set multiple Static Text values for field name variants

> List multiple Static Text values to detect field name variants such as Invoice, Invoice:, and Invoice #, using the StaticText.fsp sample project.

To detect various titles of documents, tables, fields, or any text present on all or most of the images in a document, FlexiLayout Studio uses a special **Static Text** element.

If different images processed by the same FlexiLayout have different variations of the same name (for example, the field **Invoice number** has variations **Invoice**, **Invoice:**, and **Invoice No.**), you must specify all the possible static text values even if they only differ in punctuation marks.

## Why every static text variant must be listed

This is necessary for the following reasons:

* To generate a hypothesis corresponding to the specified value. For example, if you do not specify the variant **Invoice:** but only the variant **Invoice**, the colon will not be included in the hypothesis for the field name. It may then be included in the search area of the invoice number, which is searched for to the right of the name. If the search for the number allows non-digit or non-specified characters, the colon may get into the hypothesis of the element that describes the invoice number.
* To avoid penalizing a hypothesis for characters not specified in the **Search text** window. For example, if the value **Invoice:** is specified in the **Search text** section and the name **Invoice#** is also encountered on the processed images, then, provided that some errors are permitted for the element, a hypothesis will still be generated but its quality will be penalized (in this example the FlexiLayout allows at least one error).
* If there are variant hypotheses available, for example, **Invoice|Invoice:**, FlexiLayout Studio will assign the longer hypothesis a slightly higher quality, so that the hypothesis **Invoice:** will be preferable. If a variant with a colon is specified, the one without a colon will be penalized by 0.001, because the string **Invoice** is a substring of **Invoice:**. Penalizing the shorter name string, which is a substring of the other, makes the longer hypothesis the winner.

## The StaticText.fsp sample project

The sample project `StaticText.fsp` (folder `%public%\ABBYY\FlexiCapture\12.0\Samples\FLS\Tips and Tricks\Variants of StaticText`) shows how specifying the values of a **Static Text** element helps to detect the name of the **Invoice number** field and the field itself.

The project has five pages, each showing a variant of the **Invoice number** field name.

| Page   | Name of the Invoice number field                                                                       |
| ------ | ------------------------------------------------------------------------------------------------------ |
| Page 1 | **INVOICE**                                                                                            |
| Page 2 | **Invoice:**                                                                                           |
| Page 3 | **Invoice #:**                                                                                         |
| Page 4 | **Invoice -**                                                                                          |
| Page 5 | **Invoice:** (the page also contains an **Invoice date** field, in which the word **Invoice** appears) |

## Specify all name variants in the InvoiceHeader element

The **Properties** dialog box of the **Static Text** element named **InvoiceHeader** specifies all the possible names for the field that may be found on the processed documents — in this case, the values listed earlier. Letter case in the names is irrelevant for search purposes: **Invoice|Invoice:|Invoice#:|Invoice-**.

<Note>
  To speed up the search for the element, all the variants are written without spaces. The absence or presence of spaces does not influence the quality of a hypothesis.
</Note>

For the sake of simplicity, assume that the invoice number is always located to the right of the name. To search for the invoice number, a **Character String** element named **InvoiceNumber** has been created.

Its alphabet and search constraints are specified in the **Relations** field. These settings are straightforward and are not described here. You can look them up directly in the project.

A text block **Invoice** has been created in the FlexiLayout tree. The element **InvoiceNumber** has been specified as the **Source element** for the block.

As you can see after running the analysis procedure, the field name and the invoice number can be successfully detected on all the pages.

## Remove all values except Invoice and rematch

Now try temporarily removing all the static text values except the first (**Invoice**) from the **InvoiceHeader** element, and then try matching the FlexiLayout with all the pages again. You will see that the name and the invoice number have been successfully detected only on Page 1, because the name there fully matches the specified value (**Invoice**).

On Pages 2-4, a part of the name got into the invoice number. On Page 5, there was an error in locating the number field.

<Frame>
  <img src="https://mintcdn.com/abbyy/r-nfa7jujx5b9gKX/images/flexi-capture/fls/static_text.png?fit=max&auto=format&n=r-nfa7jujx5b9gKX&q=85&s=c3effefe14366ea1164df4eb57c98fd5" alt="Screenshot of the FlexiLayout matching results in ABBYY FlexiLayout Studio after removing all but the first Static Text value, showing that the field name and invoice number are detected correctly only on the page whose name fully matches the value Invoice." width="533" height="491" data-path="images/flexi-capture/fls/static_text.png" />
</Frame>

## Restore the values and compare the Page 5 hypotheses

Now restore the removed values and look at the analysis results on Page 5, where the word **Invoice** occurs twice. As you can see, FlexiLayout Studio generated five hypotheses for the **InvoiceHeader** element.

The highest quality (**Chain quality** = 1, which, in this case, is equal to the **Pre-search quality**) is assigned to the hypothesis for the name **Invoice:**.

Hypotheses were also generated for the values **Invoice** and **Invoice d**, because these strings are derivatives of the values specified for the **InvoiceHeader** element, for which a certain percentage of errors is allowed. These hypotheses were penalized for the reasons described earlier on this page, so their final quality is lower.

<Frame>
  <img src="https://mintcdn.com/abbyy/r-nfa7jujx5b9gKX/images/flexi-capture/fls/static_text2.png?fit=max&auto=format&n=r-nfa7jujx5b9gKX&q=85&s=d47cdaaeb6991857e9e34b996be9a03f" alt="Screenshot of the analysis results for Page 5 in ABBYY FlexiLayout Studio, showing the five hypotheses generated for the InvoiceHeader element with their chain quality values after all Static Text values are restored." width="533" height="491" data-path="images/flexi-capture/fls/static_text2.png" />
</Frame>
