AutoMate Best Practices: Using Variables

by Ricky Wilcox, in Automation Strategy, posted 8/7/13
image for article

While AutoMate was designed to easily and quickly build tasks, there is still much planning that goes on before you can start dragging over your Actions.  You need to think about what you want your task to accomplish, organize your thoughts, and then turn those thoughts into steps that your task will execute.  For some this can be tricky, and tasks can become long when building them out.  One trick to make things easier is to use variables.  Before getting into the reasons of why using variables is a good practice, let’s first discuss what a variable is.

What is a variable you ask?  Think of a variable as some sort of a storage location.  A blank space in which you can assign a value to, or a place holder, if you will.  Many tasks require pulling information from databases, websites, FTP servers, and other locations. You can then use a variable to temporarily store that information until you decide what to do with it.

Other times there are things like dates, usernames, etc. that get used quite often in a task.  Instead of having to hard code that information every time you wish to use it in a step, just assign that value to a variable.

Working with variables can ease the amount of work required for a task, but when using variables it is important to stay organized.  Here are some good tips to consider when using variables:

  1. Have a simple and consistent naming convention for your variables.  It doesn’t really matter what is chosen for the variable name as long as it is the same throughout the task.  When the variables have uniform naming conventions they are grouped together in AutoMate’s Expression Builder, and can easily be called upon and used when needed.  Pick something simple like: V_xxxx or VAR_xxxx. Create Variable
  2. Now that a naming convention has been picked, it is a good idea to add some sort of description to that variable name.  If you choose VAR_xxxx as your naming convention, make sure the last part of the variable describes or identifies what value the variable will hold.  Let’s say I wanted a variable to store a date value, I would name it VAR_Date.  This way I know that this is a variable and that the variable is holding a date value.
  3. Declare all of your variables at the beginning of your task.  This helps to keep all of your variables in one place, which allows for easier editing and modifying.  If variables were spread throughout the task it may be difficult to find the one you want to edit.  Also, if all variables are declared in the beginning then there will be no issues having that variable ready when needed.

           Variables

Since information is always changing, these simple steps keep your task more dynamic and adaptable. So you have to ask yourself which is easier: manually changing every step of a task that requires an update, or updating the variable one time with new information which updates every step that variables is being used?   

 

AutoMate Tutorials