🏗️

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 thru the results of the destination or "List" block and substitute parameters in the Action block with values from the List block. This can be useful for tasks like sending data to dynamically created Sheets or files.

💡

We're using the term "List Block" to refer to the block you're using to get your list and the term "Action Block" for the one that's going to "do something", e.g. write data to a Sheet.

Demo

Sheets

  1. Select Block as the type
  2. image
  3. Select the 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).
  4. 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, e.g. some_colum
  5. 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}}'
  6. Run the block! Once it's 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 contact@seekwell.io

Required Fields

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 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's. 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:
  2. 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

  3. Create your SELECT block. You may want to include a LIMIT while testing.
  4. select s.channel, s.country, s.created_on, s.email 
    from my.some_other_table as s
    limit 2

  5. Select "Block" as the destination, "Loop thru rows" as the type and the block you created above as the block
  6. image
  7. 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.

  • Create a List Block with channels
  • Create an action Block
    • Select Block as the destination
    • Add the channel parameters to the query in the action block
  • Run the block