Loading Parameters

Loading parameters can be done in two different ways. Either using JSON formatting or by writing an SQL Query.

Loading static parameters via JSON

Static parameters are entered manually in JSON format. Every object will result in one report message being sent where each parameter is replaced with the corresponding value. You can create as many different parameters and name them as you like.

Example JSON:

        "client_name": "John Doe",
        "email_recipients": "john.doe@pushmetrics.io",
        "slack_recipients": "John Doe (U4FPP5UU8)",
        "filter_name": "Car_Brand",
        "filter_value": "Honda"
        "client_name": "Dave Doe",
        "email_recipients": "dave.doe@pushmetrics.io",
        "slack_recipients": "general (C4FPP5UU8)",
        "filter_name": "Car_Brand",
        "filter_value": "Toyota"

Slack Recipients:

Notice that in order to send dynamically to different Slack channels or recipients, the format needs to be like this: channel name (channel ID) - e.g. general (C4FPP5UU8)

Luckily, we have a built-in auto-completion for Slack channels in the JSON editor:

Loading static parameters via SQL Query

You can also load parameters in a fully dynamic way via a SQL query.

The Parameters created from your database are:
email_recipient -> from the field costumer_email
first_name -> from the field costumer_first_name
order_growth -> calculated from orders_last_week and orders_this_week

The basic idea is: Every row returned by the query is going to result in one report message. And every column will be turned into a parameter that can be used as a “merge field”.

This has a few powerful implications:

  1. You can pull a distribution list dynamically — at runtime — from your database.
  2. If no rows are returned, nothing is sent.
  3. Only returned rows produce a message You can turn a normal report into an alert rule just by adding a WHERE or HAVING clause to the query. This way you can implement any alerting logic that can be put into a SQL statement
  4. Parameters can serve as meta data to filter charts & dashboards You can pull filter values via SQL and then apply them to charts, tables & dashboards to send out personalized data visualizations .
  5. The message can be tweaked depending on the data You can bring in conditional formatting and even change entire sentences depending on KPI values. This enables a high degree of personalization and relevance. You can do this by using CASE statements in the query or {% if %} functions in the message template.

To load parameters via SQL query you need to have
a) an SQL database connection and
b) a saved query that returns the parameters

Once you select a query from the list of saved queries, the query is executed with LIMIT 1 applied to fetch the column names. If the query returns data, the column names are made available as auto-complete parameters throughout the report. We will also display a preview below the query.

If no data is returned at this point, you can still use the parameters but you will need to type them yourself.

Go to Message & Decorators to see how these parameters are applied in your Message.