Global variables

Global variables let you define one variable that many processes can use. This is handy for things like database connection strings that show up in a lot of places. If the value changes, you only need to update the global variable, not every single process.

How to Create a Global Variable

Step 1: Go to the Global Variables Tab

  1. From the Robotiq.ai platform, go to the Global variables tab.
  2. Click Create Variable.

Step 2: Configure Variable Details

The Create Variable screen opens. Fill in these fields:

NAME (Required)

  • This is how you identify your variable.
  • It needs to be unique within its scope and stage area.
  • Example: DatabaseConnectionString

IS CONSTANT (Optional)

  • Check this box if the variable's value should stay the same inside a process.
  • You can only change constant variables in the Global Variables repository.

TYPE (Required)

  • Pick the data type for your variable.
  • Options include: string, decimal, integer.

VALUE (Required)

  • Type in the first value for your variable.
  • Example: Server=mydevdb;Database=dev_data;

STAGE AREAS (Required)

  • Set different values for the variable depending on the deployment stage.
  • Example: For a development stage, you might connect to a local database. For a test stage, you'd make a global variable with the same name but a different stage area (TEST) and a different value (test database connection).
  • After testing, do this again for the production stage.

SCOPE LEVEL (Required)

  • This controls who can use the global variable.
  • Options include:
  • ORGANIZATION: All processes in your organization can use this variable.
  • DEPARTMENT: Only processes in a specific department can use this variable.
  • PROCESS: Only the processes you pick can use this variable.
  • For more about departments, see Departments and Teams.

IS VISIBLE CHECKBOX (Optional)

  • Check this box to see the variable's value in your browser.
  • If you don't check it, the value stays hidden after you create it. This is good for sensitive info like passwords.

How to Use Global Variables in Processes

You can use global variables in your processes along with local variables.

  1. Open your process in the Robotiq.ai editor.
  2. When you pick a variable in a step (like a String Input step), you'll see both global and local variables.
  3. Global variables have a blue dot next to their name.
  4. Pick the right variable for what you need.
  5. Global variables and local variables can have the same name in a process. The system tells them apart by their type.

Naming Global Variables

Follow these rules when you name global variables:

Start Character

  • The name has to start with a letter (a-z, A-Z) or an underscore (_).
  • It can't start with a number or any other character.

Allowed Characters

  • The name can only have letters, numbers (0-9), and underscores (_).
  • It can't have spaces, hyphens (-), special characters (like @, !, #), or punctuation.

Keyword Restriction

  • The name can't be a reserved keyword in Python or C#. Using a keyword will cause problems.

Python Keywords You Can't Use: False, None, True, and, as, assert, async, await, break, class, continue, def, del, elif, else, except, finally, for, from, global, if, import, in, is, lambda, nonlocal, not, or, pass, raise, return, try, while, with, yield

C# Keywords You Can't Use: abstract, base, bool, byte, case, catch, char, checked, const, decimal, default, delegate, do, double, enum, event, explicit, extern, fixed, float, foreach, goto, implicit, int, interface, internal, lock, long, namespace, new, null, object, operator, out, override, params, private, protected, public, readonly, ref, sbyte, sealed, short, sizeof, stackalloc, static, string, struct, switch, this, throw, typeof, uint, ulong, unchecked, unsafe, ushort, using, virtual, void, volatile

Things to Keep in Mind

  • Unique Names: A global variable name must be unique for its specific scope level and stage. You can't have two variables with the same name, scope, and stage.
  • Stage Alignment: If you use global variables in a process, make sure the variable exists on the stage you're publishing to. For example, if a global variable is set up for the development stage, it also needs to exist for the test stage if you publish to test. Publishing to a stage where a needed global variable doesn't exist will cause an error.
  • Deletion Restrictions: You can't delete a global variable if other processes are still using it. This stops you from accidentally breaking your processes.

Related Articles

 

Need Help?

Can't find what you're looking for? Join the Robotiq Community to get help from other users and the Robotiq team.

 

Was this article helpful?