Get to Know Your Datatypes: Number Variable

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.


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!