Tide · Triggers and selection

Fan-out (mode: 'each')

mode: 'each' creates one task for every row the selection returns. unitKey names the column that identifies a row: its value becomes the task’s unit and the last segment of the taskKey passed to the effect handler. A handler passes taskKey to its provider as an idempotency key, so a retry does not send a second mail.

Reflex
{
  id: 'seats.tonight',
  intent: 'At noon, mail each of tonight’s bookings its seats.',
  on: {
    clock: { every: 'day', at: '12:00', tz: 'Europe/Vienna' },
  },
  select: {
    query: {
      table: 'bookings',
      night: { $ref: '$.occurrence.key' },
    },
    mode: 'each',
    unitKey: 'id',
  },
  effect: {
    name: 'mail.send',
    input: {
      to: { $ref: '$.row.member' },
      seats: { $ref: '$.row.seats' },
    },
  },
}
Selected rows
[
  { id: 'B-2040', member: 'ada', seats: 1 },
  { id: 'B-2041', member: 'grace', seats: 2 },
  { id: 'B-2042', member: 'linus', seats: 4 },
]
Task units and effect calls
{
  units: ['B-2040', 'B-2041', 'B-2042'],
  effectCalls: [
    {
      taskKey: 'seats.tonight:occurrence:2026-10-24:B-2040',
      input: { to: 'ada', seats: 1 },
    },
    {
      taskKey: 'seats.tonight:occurrence:2026-10-24:B-2041',
      input: { to: 'grace', seats: 2 },
    },
    {
      taskKey: 'seats.tonight:occurrence:2026-10-24:B-2042',
      input: { to: 'linus', seats: 4 },
    },
  ],
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.