Variables and Datatypes
Overview: With the introduction of new data types in Automation Anywhere Enterprise A2019, developers have the flexibility to store and interact with new types of data as they call subtasks, read from an HTML table, and iterate through CSVs. In this learning experience, we’ll discuss the benefits of using variables and the type of variables that are appropriate for different use cases.
Variables are containers that hold values which can be used to store and retrieve data during bot execution. Variables all:
-
Have a name – which is how they are accessed and referenced within the bot’s logic
-
Have a value – which is what’s actually inside the variable (null to start for most variables)
-
Have a type – which is an indicator of the expected type of data they contain
In Automation Anywhere Enterprise A2019, variables are now strongly typed. Strong typing keeps the behavior of the logic explicit during run time by enforcing data typing and explicit conversions.
Conditional statements in bot building allow developers to execute different actions based on the evaluation of pre-defined conditions. Conditional statements can be used for things like checking to see if the bot is already logged in to a page or not, handling the response from a web service to see if a request was made successfully, or checking the result of an operation contained within a Try-Catch-Finally block to determine if the operation ran successfully or not. The logic following a conditional statement only executes if the condition resolves to true, however additional conditions can be evaluated by the use of else-if actions. Finally, if the condition and all subsequent else-if conditions all resolve to false, an else action can optionally be used as a “catch-all” for actions that should be executed when all other preceding conditions are false.
To Do
Review the documentation for variables and datatypes.
- See an overview on the variables in Automation Anywhere Enterprise A2019 and the documentation for user-defined variable types. In the user-defined variable types document, pay close attention to the “Variable type with naming recommendation”. Establishing and following a standard for variable naming enables for cleaner code that can be more easily followed by other developers.
-
Note that the “type” of variables from the first link is referring to the kinds of variables which exist in Automation Anywhere Enterprise A2019 while the “type” of variables referenced in the second link is referring to the actual “datatype” on which the variable is based.
Summary
Variables allow bots to be dynamic in the way they are set up and flexible when working with different sized data sets. The introduction of new datatypes in Automation Anywhere Enterprise A2019, enables developers to have more control over their data, perform data manipulations more easily, and explicitly convert from one type to another as needed.