--- title: "How to add global variables" slug: "how-to-add-global-variables-within-logical-rules" description: "Learn how to define global variables to control, and be referenced in, logical rules." updated: 2023-07-04T20:13:26Z published: 2023-07-04T20:13:26Z canonical: "help.floodmodeller.com/how-to-add-global-variables-within-logical-rules" stale: true --- > ## Documentation Index > Fetch the complete documentation index at: https://help.floodmodeller.com/llms.txt > Use this file to discover all available pages before exploring further. # How to add global variables Global variables can be defined to be controlled by and referenced in logical rules. This enables a user to, for instance, create a timer to start when a certain condition is met, and for multiple gates, pumps, and/or abstraction units to then be controlled by this global timer. ![](https://cdn.document360.io/5074bc26-a9ef-4bf4-b1de-a5c6ce628aca/Images/Documentation/rules-globalvariables.PNG) Note: This guide covers the minimum data required. Several optional settings are also available for logical rules, please see the [Rules](/v1/docs/rules) section of the technical reference for further details. ### Steps 1. On the **1D River Build** tab, click **Edit Variables**. This will open a new window. 2. Click **Add Variable** and a new row will be added to the table. 3. Define your variable(s) by filling out the table fields: - Enter a unique **Name** for your variable. - From the drop-down provided, select the **Variable Type** required; Timer, Integer, Float, Binary, or Ternary. - For a variable of type Timer, an **Initial Status** (ON or OFF) must be provided. - A **Comment** can optionally be provided for each variable. - An **Initial Value** for the variable can also be provided (leaving this column blank will result in the default value of 0). 4. Click **OK** to save when you have fully defined your variables. 5. Use your global variables within logical rules in any applicable units ([sluice or gated weir](/v1/docs/how-to-apply-logical-rules-to-a-sluice-or-gated-weir), [pump](/v1/docs/how-to-apply-logical-rules-to-a-pump) or [abstraction unit](/v1/docs/how-to-apply-logical-rules-to-an-abstraction-unit)) in the normal manner. An ALSO statement can be used if needed. An example is provided below. Example usage: switching a global timer on (and setting no abstraction) when the flow is a specified level. RULE1 IF(FLOW(A2).LE.100.0) THEN ABS= 0 ALSO MyGlobalTimer=ON END 6. Click **OK** to save and close the unit. Don't forget to also **Save** these changes to the network.