Blocks as a destination

You can use a table created by a Block as your destination. When using the block as a destination, the primary or "Action" block will loop through the results of the destination, or "List", block. The query will then substitute parameters in the Action block with values from the List block. This function can be useful for tasks like sending data to dynamically-created Sheets or files.

We use the term "List Block" to refer to the block you use to get your list, and the term "Action Block" for the one that’s going to "do something", or write data to a Sheet.

Demo

Sheets

  1. Within your Block, select the field under Destination and select Block as the type.

    Select Block as destination type

  2. Below Type, select Block and select the desired list block from the drop-down. You can filter the list by the block name. Your List Block must have the required fields for the destination type (see below).

  3. Add ⚙ Parameters from the List Block into the Action Block using the same name as the column name in the List Block. Keep the parameter type as the default "value". Make sure there are no spaces in the column name, for example, some_column.

    Parameters example
    select '{{email}}' as assigned_to, u.channel, u.plan, u.email as user_email
    from dummy.users as u
    where 1=1
    and u.channel = '{{channel}}'
  4. Run the block. Once complete, check your email for the reports.

There is a 500 row limit on Destination Lists. If you need that limit removed, please contact us at [email protected].

Required fields

  • Sheets
    You can use this sheet as a base, by creating a copy:
    Use Sheet example

    • type = sheets

    • ss_id (long UUID from within the URL of a Sheet)
      Select UUID from Sheet URL

    • sheet

    • append

      • TRUE

      • FALSE (default)

    • cell (A1)

  • Slack

    • channel

  • Email lists

Using a SQLite query as the block

You can define the List block with a SQLite query. Select "Blocks" as the source to use SQLite. For example, to create a new Sheet for everyday use:

SELECT
date('now') as dt,
'sheets' as type,
'REPLACE_WITH_YOUR_ID' as ss_id,
date('now') as sheet,
'FALSE' as append

Using INSERT, UPDATE, DELETE statements

You can send rows from one query to a block that performs, for example, INSERT. This can helpful if you need to move data from one database to another. You can also use this to grab data from a Sheet and insert it into a database.

  1. Create a block with "value" ⚙ Parameters. For example:

    INSERT INTO your.users (channel, country, created_on, email)
    VALUES ('{{channel}}', '{{country}}', '{{created_on}}', '{{email}}');
    Be sure to properly quote text / string columns. Make sure the "name" you give the parameter is the same as the name in your SELECT block.
  2. Create your SELECT block. You may want to include a LIMIT while testing.

    select s.channel, s.country, s.created_on, s.email
    from my.some_other_table as s
    limit 2
  3. Select Block as the destination, Loop thru rows as the type, and the block you created above as the block.

    Select Block as destination

  4. Run the block and verify the results in your destination database.

Case study

An apparel company wants to add a sample of customers who abandoned their cart to three different Sheets daily. Each PM is responsible for a separate channel and should only see customers from their channel.

  1. Create a List Block with channels.

  2. Create an action Block.

    1. Select Block as the destination.

    2. Add the channel parameters to the query in the action block.

  3. Run the block.


Was this page helpful?