Using data

Many steps in Axiom allow data to be passed from previous steps. In earlier parts of the documentation, you will have seen how to use data in specific circumstances. This page will describe how the system works in general.

# Understanding Data variables

Data variables are a way to store and use information during your automation. There are three variable types in Axiom, all of which have a different appearance and functionality:

# Global variable

This token is accessible anywhere, and you will always have direct access to all the data in this variable. This variable is overwritten with new data every time it is generated - loops will not accumulate data. For that, use an accumulator variable.

# Loop variable

This variable is being used as an input for a loop, and will automatically select the row for you. You can still select a column.

# Accumulator variable

This is a special type of global variable that will automatically contain the contents of every sub-step inside it. Data is appended to the accumulator in the same order the steps appear, and it will also accumulate the results of multiple loops.

# Pass data from one step to another

Many steps in axiom output data. You can see which steps output data by looking in the header section of a step; those which contain an orange plug icon will output data.

Data variables have a specific name, which is used to refer uniquely to the output of that step, for example google-sheet-data, custom-data, scrape-data.

Fields that can accept data will contain an "Insert data" dropdown. Selecting the data variable from this dropdown will pass the data from the step that produced it into the current step for processing.

When passing data, you can either pass all the data or select a subset of data to pass. For data that supports this, you will see the following window when adding data:

To pass specific columns, click the "Clear All" and then click the column headings to select the data you wish to pass.

At runtime, the data will be replaced with the output from its associated step, exactly as though you had entered that data manually into the box.

Some steps require data to be passed to function. In these cases, if you have not yet added a step that outputs data you will be warned with a message "This step requires data input to function. You should add a step that outputs data before this one to use it.".

Almost all of the data output from steps are formatted as a two dimensional array of rows and columns, identical to the format used in a spreadsheet. All steps that can handle data will accept this format, and will behave appropriately.

All data in axiom is immutable, which means that it is constant whenever it is used. Data output from a step is never modified in place by any other step.

However, many steps are able take data as input and produce a new result, which is a modified version of the passed data.

In these cases, the original data remains unchanged and a new data variable is created with the modified value. This is useful to perform tasks such as removing duplicates, removing rows which contain or do not contain values, replacing text, and more.

# Loop through data

The Loop through data step allows you to loop through the rows in a data variable and process a series of sub-steps for each value in that variable.

In this mode, you can select which columns should be used, and it will use these columns for each row in the data.

For more information on how to use this, please see Automating the UI.

For more advanced uses of looping, please see Conditional Logic and Looping.

# Click on multiple buttons one by one

Often, it is necessary to click on multiple buttons one by one, for example, when dealing with a long list of requests, each requiring individual action. In the example below, the goal is to click on each "Break down item" one by one. This can be achieved by identifying a common pattern for the selector representing each button and then instructing the bot to click on that selector.

  1. Create a Loop step and add a "Click element" sub-step.

  2. Within the "Click element" sub-step, click on the "Select" button and press the "Custom" button to identify the custom selectors.

  1. To identify a common pattern for each button, click on each button one by one. Observe how the custom selector changes for each button. For example, for the first button, it will be li:nth-of-type(1) > div > div:nth-of-type(2) > div > div > button, and for the second, it will be li:nth-of-type(2) > div > div:nth-of-type(2) > div > div > button.
  1. We have established the custom selector pattern for each button. To instruct the bot to click on each button, create a Google sheet with the list of each selector corresponding to each button.
  1. In your automation, add a "Read data from Google sheet" step and use the Google sheet with selectors, in this case, the "Custom selectors" document. Your automation will consist of "Go to page", "Read data from Google sheet," and "Loop through data" steps. In the "Loop through data" step, select the [google-sheet-data] token and enable the option "Loop through all."
  1. In the "Click Element" step, click on the "Select" button → press "Custom" button → enable "Set selector from data" → in the dropdown menu "Insert data," choose [google-sheet-data] token → click "Save and close" → then click the "Complete" button.
  1. Now run your automation and observe that the bot will click each element one by one.

# Use custom data

It is possible to pass data using a “Custom data step”.

It works best if you have a short list of values which you need to pass to one of the steps:

  1. Click on “Add a step” button
  2. Choose the “Custom data step”
  3. Enter a list of items to store as data; each line will be stored as a new row. As shown on the screenshot below, each city will be stored as a separate row.

# Import a CSV

Axiom allows to import a CSV file:

  1. Click on the “Add a step” button
  2. Select “Import CSV file” step
  3. Select CSV file to upload. If you see corrupted characters, please make sure the file is encoded in UTF-8 format.
  4. If needed, specify the first and last cells which Axiom needs to use. For example, when specifying the values A1 and A3 respectively, only the data from the first three rows in the CSV file will be read by Axiom.

The data from the CSV file can then be used in other steps by specifying the “imported-csv” token. If multiple CSV steps are added, then the token will be “imported-csv_1”, “imported-csv_2” etc.

# Export to CSV

Axiom allows to export data into a CSV file:

  1. Click on the “Add a step” button
  2. Select “Export CSV file” step
  3. Select the folder where the file will be downloaded.

The “Export to CSV” step is available when running on Desktop app or when using VPS, it is not available when running an Axiom in the cloud.

The CSV will be downloaded to your Chrome downloads folder when the automation runs. Please note that the CSV will not download if triggered from an external service or API.

# Upload CSV to a Google sheet

It is also possible to upload a CSV to a Google sheet, for detailed instructions see page Using Google Sheets