Message & Decorators

If you choose to send Simple Report there is a limited amount of static parameters that can always be used:

Date Parameters:
{{ ds }} ==> today’s date
{{ ts }} ==> current timestamp
{{ yesterday_ds }} ==> yesterday’s date
{{ tomorrow_ds }} ==> tomorrow’s date
{{ ds | date_format('Today is %d, %b %Y') }} ==> format using “Today is …“
{{ ds | date_add(7) }} ==> adds 7 days to today’s date
{{ ds | date_subtract(3) }} ==> today’s date - 3 days
{{ ds | date_add(7) | date_format('Next week's date is %d, %b %Y') }} ==> sample mix

Mail Merge Reports allow you to load custom parameters using JSON, SQL, or a Tableau view. These Jinja-syntax conditionals will work on all your parameters.

IF statements:

{% if parameter > 0 %}
    {{ parameter }} is > zero 
{% else %}
    {{ parameter }} is <= 0
{% endif %}  

Loops:

{% for item in parameter %}
item is: {{ item }}
{% endfor %}

Sample Message:

Hi everyone,

Please find yesterdays ( {{ yesterday_ds }} ) report attached to this email.

{% for region in sales_region %}
    {% if region > 10000 %}
        {{ region }} sales were above 10000 yesterday! 
    {% endif %}
{% endfor %}

Best regards,
...

Templating Syntax

The general syntax to use parameters in the report template is {{ parameter_goes_here }} and is following Jinja templating syntax. For example, if your JSON or SQL has a parameter named first_name
you can apply it like this: {{ first_name }}
Please make sure you don’t have spaces in your parameter names. A simple typo will result in an empty space in your report. You can also use more advanced options to dynamically change the message.

JSON Parameters:

Assuming you have imported the same parameters as given in the Loading Parameters section.
Your JSON parameters look as follows:
Sample:

[
    {
        "client_name": "John Doe",
        "email_recipients": "john.doe@honda.io",
        "slack_recipients": "John Doe (U4FPP5UU8)",
        "filter_name": "Car_Brand",
        "filter_value": "Honda"
    },
    {
        "client_name": "Dave Doe",
        "email_recipients": "dave.doe@toyota.io",
        "slack_recipients": "general (C4FPP5UU8)",
        "filter_name": "Car_Brand",
        "filter_value": "Toyota"
    }
]

As you have TWO entries, this JSON will create TWO reports. One for John, one for Dave.
Please Note:
Your filters will only apply if you add your chosen value for “filtername” (here: “Car_Brand”) and the parameter {{ filter_value }} into your attachment.

See the Attachments section if you are unsure. Decorate your Message as follows:

For clarification; the message that John receives will look something like this:

Subject:
Sales Report Honda, 2020-01-01 to 2020-01-08
-> {{ filter_value }}, {{ ds | date_subtract(7) }} to {{ ds }}

Message:
Dear John Doe, -> {{ client_name }}
attached to this Email: Last week’s Sales Report for the Brand Honda. -> {{ filter_value }}
Best regards,


Destinations
Sharing Settings