Scheduled reports

Scheduled reports

Scheduled reports allow you to send reports in any format you choose, to your users who have decided how often they want a report.

A report is generated by your users creating a "basic table" component on their dashboard, and then selecting the "reports" option in the component menu.

Vizzly manages the time-keeping of such reports, and sends you a webhook containing the query needed to generated the results for the report at the time your user wants it.

Once you have set up the webhook and linked it to the dashboard template, you can add the property reportScheduleOptions to the Vizzly Dashboard component, and set the frequency values that you want to be made available to your users to choose from. For example, you might set;

<Vizzly.Dashboard
  // ... the other props
  reportScheduleOptions={[
    { cron: "* * * * *", description: "Every minute" },
    { cron: "0 * * * *", description: "Every hour" },
  ]}
/>

which would allow your users to pick from an "every minute", or an "every hour" schedule.

The webhook event

An example of the event you'll receive for scheduled reports.

You'll receive a query which you can use with the data access token generated in your identity callback to call the query engine's create results endpoint.

{
  "type": "report.scheduled",
  "report": {
    "dashboard_id": "dsh_0b32455...",
    "organisation_id": "org_7e58f...",
    "schedule": "* * * * *",
    "type": "scheduled",
    "user_reference": "user 123456"
  },
  "query": {
    "dataSetId": "stock-data-set",
    "dimension": [],
    "filter": [],
    "limit": 10,
    "offset": 0,
    "measure": [
      {
        "aggregate": "none",
        "field": "fie_1"
      },
      {
        "aggregate": "none",
        "field": "fie_2"
      },
      {
        "aggregate": "none",
        "field": "fie_3"
      },
      {
        "aggregate": "none",
        "field": "fie_4"
      },
      {
        "aggregate": "none",
        "field": "fie_5"
      }
    ],
    "order": [
      {
        "aggregate": "none",
        "direction": "asc",
        "field": "fie_2"
      }
    ],
    "timeDimension": null
  },
  "virtualFields": {}
}
💡

Some scheduled report implementations increase the limit property and ensure the offset value is 0. This has the effect of creating a full data-set export.

Last updated on January 30, 2023