Logic Step
  • 3 Minutes to read
  • Dark
    Light
  • PDF

Logic Step

  • Dark
    Light
  • PDF

Each Logic River is made up of a series of logic steps.

Logic Step Type

From the drop down in the top left corner of the logic step, you can choose your type.

image.png

Each logic step type is a different task type.

Logic Step type overview:

  • River: Trigger an existing river in your account to run.
  • SQL / Script: Run an in-database query and store the results into a table or file storage, or run custom SQL script in the syntax of your cloud database.
  • Action: Make any custom REST call
  • Condition: Perform conditional logic in your workflow. For example, skip a step in the process if a certain condition isn't met.

Option 1: River

The 'River' option of a logic step will trigger the selected river to run.
image.png

For example, the logic step above will trigger an existing river in our account called 'FB ads' which pulls ad data from the Facebook Ads connector.

Option 2: SQL / DB Tranformations

The 'SQL / DB Tranformations' option allows for in-database transformations using a query or SQL statement (the SQL syntax to be used is that of your cloud data warehouse).

First, select your desired cloud database and set the connection.

image.png

Next, enter your query into the 'SQL' box. You can click the magnifying glass to enlarge the space where you can view the query.

Notes -

  • It is recommended that you build the query itself in the query editor of your cloud database, so that testing and debugging can be most efficient.
  • If comments are nessecary, use the comments syntax /* comment*/. The alternative option: --comment syntax make all the next query to be remarked as comment. Therefore, please try to avoid using this syntax in Logic in Rivery.

After the query has been pasted into the Source section, it's time to decide on the desired target. In 'SQL / Script' logic step types, Rivery can store the results of the source query into a database table, variable, or file storage.

image.png

When storing data into a database table, you can choose between three loading modes: Overwrite, Upsert-Merge, and Append Only.

  • Overwrite: Replace the target table completely with the data from this run. If the target table does not yet exist, it will be created automatically.
  • Upsert-Merge: Only add new or changed records to the target table based on a defined key in the Column Mapping.
  • Append Only: Union the data from this load onto the existing target table.

If you choose to use Upsert-Merge functionality, you can define your merge key by clicking into the Column Mapping (at the very bottom of the logic step) and highlighting the key indicator for the desired field. You may need to first select 'Auto Mapping' to fetch your table schema.

logicstep_mceclip21.png

The next option for storing data into a target is file storage. The type of file storage allowed will depend on what cloud connection you are using. The supported file store options are Amazon S3, Google Cloud Storage and Azure Blob Storage.

image.png

For this option, enter the bucket you wish to save the results as well as the desired file name. By scrolling down, you'll see more options to customize by file type, delimiter (for CSV) and compression.

image.png

Lastly, the 'SQL / Script' logic step type provides the ability to store data values into variables which can be called downstream in the Logic River.

image.png

In a SQL/Script logic step, variables can be saved at the river level or global level. A river variable will allow for dynamic passing of values from step to step within the same logic river session. A global variable enables the passing of values into an account-level variable, (found on the 'Variables' page in left-hand panel) which can then be used in other rivers.

Option 3: Action

The 'Action' logic step will trigger an existing Action river in your Rivery account. Action Rivers allow for custom REST calls to any API on the web.

Once the desired Action River is selected, any inputs corresponding with the river will appear for enhanced customization.

image.png

For a more in-depth walkthrough of Action Steps in Logic Rivers, see the Action Step documentation.

Option 4: Condition
The 'Condition' logic step type allows for enhanced conditional capabilities in a Logic River. Upon selecting this option, a user interface for applying a condition to a logic step will appear.

image.png

Here you can enter a static value or existing variable for which your condition to meet. Based on the results of the condition as its processed, you can choose to run a step, pass over it, stop it, or fail the river.

If the condition is not true, there is a second conditional container where the 'ELSE' of your condition is processed.


Was this article helpful?

What's Next