How to use logic in your automation
Axiom.ai's step finder contains a range of no-code steps that allow you to use logic to change the behaviour of your automation. For example, execute a different set of steps depending on a condition.
In these steps, you must pass data to set up your condition. This can be done in several ways, for example, by using a data source you provide, such as a Google Sheet, or by scraping data from a webpage to create your condition.
# Run a set of steps depending on an If condition
To run a particular set of steps based on whether a condition is true or false, use the "If a condition is true, run steps" step. This step allows you to compare values, either string or numeric, and then execute the appropriate steps.
To use this step, follow these instructions:
How
- Open the step finder, search for "IF", add the step, and configure it.
- Set the "Data to check".
- Set the "Condition to check".
- Set the "Reverse condition" to true or false.
- Add the steps you wish to execute.
Once the condition has been executed, the automation will continue to run the steps placed after the condition. Learn more about the "If a condition is true, run steps" step here.
# Example of using the "If a condition is true, run steps" step
We often use this step to check if a button exists. If it does, we run steps to interact with it. For example, on Instagram profile pages, we scrape the message button. If the text "message" is found, we click the button and send a message. If not found, the automation completes the loop without sending a message.
# Run different sets of steps using an If/Else condition
To run a particular set of steps based on whether a condition is true or false and another set of steps if the condition is false, you can use the "If/Else condition" step. This step allows you to compare string or numeric values and then execute the appropriate steps.
To use this step, follow these instructions:
How
- Open the step finder, search for "IF/Else", add the step, and configure it.
- Set the "Data to check".
- Set the "Condition to check".
- Set the "Reverse condition" to true or false.
- If the condition is true or false, Add the steps you wish to execute.
- Else, Add the steps you wish to run.
Once the "If/Else condition" step has been executed, your automation will continue to run the steps placed after it. Learn more about the "If/Else condition" step.
# Example of using the "If/Else condition" step
This step can be used to automate form filling when the form changes based on a data value being entered that requires a different set of fields to be completed.
# How to stop or continue the run based on a condition
You can use the "Continue only if a condition is met" step to stop or continue your run based on a condition.
To use this step, follow these instructions:
How
- Open the step finder, search for "continue", add the step, and configure it.
- Set the "Data to check".
- Set the "Condition to check".
- Set "Fail if condition not met".
- Set "Reverse condition" to false.
Learn more about the "Continue only if a condition is met" step.
# Example of using the "Continue only if a condition is met" step
This step could be used to check for a value in a Google Sheet. The run stops if the value is not found because the Google Sheet is empty.
# How to jump to another step based on a condition
You can use the "Conditionally jump to another step" step to skip steps depending on a condition. You can also enter a value to loop this jump step.
To use this step, follow these instructions:
How
- Open the step finder, search for "Jump", add the step, and configure it.
- Set the "Data to check".
- Set the "Condition to check".
- Set "Jump to step".
- Set "Maximum cycles".
- Set "Reverse condition" to false.
Once the step has run, the automation will continue to the next steps. Learn more about the "Conditionally jump to another step" step.
# Example of using the "Conditionally jump to another step"
This step can be used to skip steps or jump back to repeat a set of steps. For example, you can keep clicking a "Next" button until a value is found on the page.
# Try/Catch
You can use the "Try/Catch" step to run a set of steps and run another set of steps if they cause an error. Unlike other logic steps, you need not set up a condition. The step will trigger if an error is caused by the steps in the "Try" section.
To use this step, follow these instructions:
How
- Open the step finder, search for "Try", add the step, and configure it.
- Add sub-steps to the "Try" section.
- Add sub-steps to the "Catch" section.
- Set "Jump to step".
- Set "Maximum cycles".
- Set "Reverse condition" to false.
Once the step has run, the automation will continue to the next steps. Learn more about the "Try/Catch" step.
# Example of using the "Try/Catch" Step
This step can be used to handle errors during your automation run. For example, if your automation sometimes triggers a popup that causes an error, you can use this step to interact with and close that popup.
# Javascript
It is also possible to construct your own logic using JavaScript and its array of functions. To learn more about how to use JavaScript in Axiom.ai.