BACK

Get to Know Your Datatypes: Number Variable

CATEGORY:

Get to Know Your Datatypes: Number Variable

Beyond clicking their way through applications and making calls to application programming interfaces (APIs), bots use the data gathered from applications to make decisions and perform calculations. In support of these efforts, there is a dedicated variable type to hold numerical values: the Number variable. The number variable can store numeric values (including integers and decimals) from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807, and up to 15 decimal digits. Let’s take a look at a couple of common ways that Number variables are used within bots.

  1. Number Package

    1. The first and most obvious place that Number variables are used is within the Number package.
    2. The Number package allows for basic operations in dealing with Number variable types:
      1. Assign: Assign a specific number to a new variable. This also includes taking arithmetic operations on other Number variables (or by hard-coding numbers) to include addition, subtraction, multiplication, and division.
      2. Decrement: Decrement an existing Number value by a set amount – helpful especially for looping or look-back type operations.
      3. Increment: Increment an existing Number value by a set amount – again helpful for looping, also commonly used with Excel operations.
      4. Random: Assign a random number to a new/existing Number variable. Useful for automating operations that need to look more “human” – i.e. randomized delay between operations on a web site that seems to be tracking traffic or sending a message using randomized text from a list so not every message looks the same.
      5. To String: For displaying in a message box or saving out the number to a log file/Excel. It’s very common to use this operation and its inverse (The String package action to convert a String to a Number)
  2. Loops

    1. The use of Number variables within a loop enables developers to keep track of which iteration, or count, the loop is currently on and take specific operations accordingly.
    2. Numbers are used directly in the Loop package itself (For n times iterator as an example) or through manually incrementing Number values in a loop.
    3. Example:
      1. If a bot needs to loop through an Excel Spreadsheet, the Loop action may be used with the Excel basic iterator to loop through each row in a worksheet. The loop itself returns a record variable for each iteration through the loop (which is the equivalent of an entire row in the spreadsheet). While that’s great, if the bot needs to update/insert data in the spreadsheet, a Number variable would be needed to ensure that the correct row can be updated with the appropriate data.
  3. Conditional Statements

    1. Conditional statements are one of the core tenents of problem-solving.
    2. Conditional statements enable bots to take action as the result of evaluating a condition to be true or not.
      1. These statements enable bots to only take certain actions if a condition is true and to take alternative actions if the condition is not true.
    3. Example:
      1. The “Invoice Payment Bot” is designed to make payments on invoices that are received to automate a function of the accounts payable process. In an effort to reduce fraud, the bot checks the current invoice amount against the last 12 invoice amounts with this vendor to ensure that the invoice amount is within a reasonable range of the 12-month invoice average. A conditional statement based on a number variable is set up within the bot to check to see if the invoice amount exceeds the 12-month invoice average by more than 25%. If it does, the transaction is sent to a user through the AARI interface for final validation before the payment is sent. If the invoice is within 25% of the 12-month invoice average, the payment is made directly through the bot.

Conclusion

The Number variable type is very useful when performing arithmetic operations, inserting/updating data in a spreadsheet, or when used to establish conditional statements for handling bot logic. If you haven’t used Number variables much in your bot builds so far -what are you waiting for!?!? Start using Number values today to further extend the capabilities of your robotic process automation builds. Using them already? Let us know on Twitter and Linkedin the different ways you’re using Numbers within you bots!

Haven’t tried out the Enterprise A2019 platform yet? Head over to the Enterprise A2019 product page to learn more about product features, request a demo, or try out a free trial today!

Related Articles
A2019
Number Package
String Package
Variables
Is it a Number!?!
With so many numbers that show up within the data that bots use (SSN's, phone numbers, loop counters, etc.), it can be tough at times to know which should be stored as a Number variable and which should be a String. Let's break that down by playing Is It a Number! Read More
A2019
beginner
Variables
RPA for Newbies: Bot "Grammar"
RPA Tips for Newbies, where Automation Anywhere experts offer advice for those just starting to learn RPA. In this session: Bot "Grammar" and common variable naming issues. Read More
A2019
A360
Dictionary
Variables
Get to Know Your Datatypes: Dictionary Variable
Dictionaries in Automation 360 enable developers to store, retrieve, and loop through key value pairs of data. This is a great way to store relatively large amounts of data without having to create a ton of individual variables for each piece of data.. Read More