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

# Global constants

> Define global constants for a FlexiLayout on the Constants tab of the Properties dialog box and use them in FlexiLayout language search expressions.

<Note>
  Global constants are used to specify additional search criteria (element's Properties dialog box, Advanced tab, Advanced pre-search relations and Advanced post-search relations sections; block's Properties dialog box, Expression field).
</Note>

Global constants are set for the entire FlexiLayout and accessible in all sections of the program code.

When creating a global constant, you must specify its name and value. The name of a constant must start with a letter or an underscore character, and then it can consist of letters and digits. Constant names must not contain blank spaces or special symbols. The name of a constant must be unique for the FlexiLayout in which it is to be used and cannot coincide with any of the [reserved words](/flexi-capture/fls/language/r-keywords). This means that you may not declare variables in the code whose names coincide with the names of the global constants.

Constants may be of any type which has a constructor in the [FlexiLayout language](/flexi-capture/fls/code/general-code). The type of a constant is either defined explicitly by calling its constructor, or is derived by the program from its value (for example, type String). When you use a constant in your code, the compiler will check that this type of constant may be used in the given context. This check is performed when you build the FlexiLayout or when you ask the program to check the code in a particular field.

You can create global constants using global functions and other already created global constants.

*Examples of global constants*:

| **Name**                   | **Value**                                                                                   | **Type** |
| -------------------------- | ------------------------------------------------------------------------------------------- | -------- |
| RomanNumerals              | "I V v X x"                                                                                 | String   |
| SomeRect                   | Rect( 5mm, 10mm, 20mm, 50mm )                                                               | Rect     |
| FirstPageRect              | Page( 1 ).RectGlobal                                                                        | Rect     |
| UpperHalfOfFirstPage       | Rect(FirstPageRect.Left, FirstPageRect.Top, FirstPageRect.Right, FirstPageRect.Height / 2 ) | Rect     |
| UpperHalfOfFirstPage1      | Region( UpperHalfOfFirstPage )                                                              | Region   |
| TotalLineHeightOfFirstPage | Page( 1 ).AverageLineHeight() + Page( 1 ).AverageInterlineInterval()                        | Distance |
| Q\_50\_Percent             | Quality( 0.5 );                                                                             | Quality  |

## Add, change, and remove global constants

### Add a global constant

<Steps>
  <Step title="Open the Properties dialog box">
    On the **FlexiLayout** menu, select **Properties...**; or right-click in the **FlexiLayout** window and select **Properties...** on the shortcut menu.
  </Step>

  <Step title="Open the Constants tab">
    In the **Properties** dialog box, click the **Constants** tab.
  </Step>

  <Step title="Add the constant">
    Click **Add...**, type a name and value for the constant, and then click **OK**.
  </Step>
</Steps>

### Change a global constant

<Steps>
  <Step title="Open the Properties dialog box">
    On the **FlexiLayout** menu, select **Properties...**; or right-click in the **FlexiLayout** window and select **Properties...** on the shortcut menu.
  </Step>

  <Step title="Select the constant on the Constants tab">
    In the **Properties** dialog box, click the **Constants** tab, and then select the constant you want to change.
  </Step>

  <Step title="Edit the constant">
    Click **Edit...**, type a new name and value, and then click **OK**.
  </Step>
</Steps>

### Remove a global constant

<Steps>
  <Step title="Open the Properties dialog box">
    On the **FlexiLayout** menu, select **Properties...**; or right-click in the **FlexiLayout** window and select **Properties...** on the shortcut menu.
  </Step>

  <Step title="Select the constant on the Constants tab">
    In the **Properties** dialog box, click the **Constants** tab, and then select the constant you want to remove.
  </Step>

  <Step title="Delete the constant">
    Click **Delete**.
  </Step>
</Steps>

<Note>
  A constant name must be a valid identifier, that is, it must consist of the characters "\_ a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z" and digits. The first character in the name must not be a digit. Constant names must not contain blank spaces or special symbols.
</Note>
