Sep 2, 2023

Burst PDF reports with the Task Scheduler

From Canvas 2.0 and up, there is now a Task Scheduler which you can use to schedule tasks. These tasks can contain TM1 processes, TM1 chores or Canvas pages. This article describes the steps to follow to set up a new task which is going to send by email one dashboard per region.

SMTP Configuration

Before scheduling a task, you should check if the SMTP configuration has been configured correctly. Canvas allows you to send emails, which it does by accessing an SMTP server. For most corporate networks, the SMTP server can accept any requests to send an email from servers within the same network.

This is an example of settings with an Office 365 accounts, you can test your settings with the paper plane button at the top right:

For more information about SMTP configurations, you can check the following Help article: Email settings.

Open Task Scheduler

There is one Task Scheduler per application, you can access it from the admin section:

  • http://<server name>:8080/<application name>/admin#/task-scheduler

For example, to access the Task Manager of the samples application:

  • http://localhost:8080/samples/admin#/task-scheduler

Create a new task

In this page you will see the list of tasks. Click the Add New Task button at the top right:

Add name and instance settings:

The name is the task name which will appear in the main page. There is a status button which is active by default. You then need to add the login information of the TM1 instance that will be used on this task:

  • Instance: TM1 instance name defines in the instances.json
  • User Name: TM1 user
  • Password: TM1 Password
  • Use CAM: Yes if you are using CAM Security
  • CAM Namespace: CAM Namespace

Add Schedule (optional)

The next step is to schedule the task, add a name for the schedule and then click the schedule button:

A pop-up window will appear with different options to choose from for scheduling your task such as every month, week, day, etc.:

Click the Check Schedule button to see when its next runs. Finally click Apply Schedule.

Add an action

There are different action that you can add such as run TM1 process, TM1 Chore, add a wait and run a report. In this example we will add a Report:

Then click on the icon to update the information about the report:

Email information

For each report you need to specify the email information. The description is used only in the Task Scheduler. If you burst multiple reports, you can choose between sending one Email for all reports or one email per attachment:

Report information

Attachments are the URL path to the Canvas pages. Canvas uses the URL to create PDF reports. If you want to send the report with the filter region, you have to make sure that the filter is in the URL, if not it will always print the report with the default filters. To learn how to dynamically update the URL, you can check the following help article: Update the URL before printing.

In this example, the bursting will be based on the regions. In the attachment name and in the url we use {{region}} to get the value of the region we are bursting:

Burst information

There are different ways to drive your bursting. You can either drive the bursting based on a Dimension Subset, Dimension MDX, Cubeview, CSV file or a path to a CSV file. You can mix and match these. You can also use these in the three special markups. Combining these can potentially help you manage the recipients by Region for example.

In this example we drive the bursting based on the Default subset of the Region dimension:

Each type of burst item presents you a placeholder variable which you can then use in the Email or Report tab. The placeholder name is the name of the variable you can then use in either Report or Email tab.

Click Save button

The last step is to save the task:

Tasks list

Once save you will than see the new task in the Task List, you can then disable or enable them from this page:

Execute

Just click the execute button if you want to test your new task. In this example we receive one email with one report per region in the Default substet:

To send one email per report, in the Email tab click An Email per Attachment Burst, in the email subject you can use {{region}} to add the region name:

You can even customize the email body with some information about the region such as attributes or key KPIs. To bring this information you can either use DBRA or DBR with the following syntax:

  • [[ dbr:<instance>:<cube>:<elements> ]

o i.e. [[dbr : dev: Product :Actual, 2012, Local, Finland, All Products by Category, Standard Cost]]

  • [[ dbra:<instance>:<dimension>:<element>:<attribute> ]]

o   i.e. [[dbra : dev: Region :Finland: Currency]]

o   i.e. [[ rundate: yyyy.MM.dd]]

For example in the example below, the email body will contain the Currency attribute, the Standard Cost and List Price value:

Tasks folder

All Tasks can be found in the \CWAS\webapps\\WEB-INF\config\tasks folder:

For the samples application:

  • C:\CWAS\webapps\samples\WEB-INF\config\tasks

The Task ID is found in the URL when a task is opened in the Task Scheduler:

This should help you find the file within the config/tasks folder if it needs to be moved into a different server, or for backing up purposes.

To learn more about the different sources for bursting reports you should check the following article:

Related content

Loading related content