To test generating a PDF, type the following command:
Notes:
If the PDF generates successfully, tabcmd places the PDF file "progressReport.pdf" in the current working directory.
While the tabcmd by itself cannot send email messages, if you are using Tableau Server 8.0 and later, you can configure email alerts if there is a system failure or subscriptions that allow users to subscribe to their favorite views. Alternatively, you can easily add this functionality through scripting. Many applications and scripting languages are available, and you can combine the printing automation of tabcmd with practically any other logic. Two examples illustrate this capability.
This example uses email shareware called febootimail.exe (search the Web for "febootimail" for more information). This program allows full control over aspects of the e-mail generation.
Here is an example that sends as an e-mail attachment the PDF progress report you generated in the last example.
Send formatted email with an embedded image
Tabcmd can generate PNG files, and febootimail.exe can send HTML e-mail. The febootimail help says that the HTML file must be in the same directory as febootimail.
Here is an example script:
tabcmd get "<url-of-view>.pdf" -f "<filename>.pdf"
Notes:
- Replace
<url-of-view>
with the view's URL path after it has been published. - In versions of Tableau Server earlier than 9.0, ensure that you append
<url-of-view>
with ".pdf", as in the example above. In Tableau Server 9.0 and later, you do not have to include the filename extension with the<url-of-view>
value for PDF files; the command infers that you want a PDF file from the name you provide in the-f
parameter. - Replace
<filename>
with the name you want to give to the generated PDF file.
tabcmd get "/views/Wow/SummaryReports.pdf" -f "progressReport.pdf"
If the PDF generates successfully, tabcmd places the PDF file "progressReport.pdf" in the current working directory.
Note: For Tableau Server 8.1 through 8.3, ensure that you do not include the hash tag (#) and number at the end of the URL. For Tableau Server 9.0 and later, do not include ":iid=<n>."
This example uses email shareware called febootimail.exe (search the Web for "febootimail" for more information). This program allows full control over aspects of the e-mail generation.
Here is an example that sends as an e-mail attachment the PDF progress report you generated in the last example.
tabcmd login -s http://tableauserver:80 -u admin -p admin
tabcmd get "/views/Wow/SummaryReports.pdf" -f "progressReport.pdf"
febootimail.exe -SMTP yourSMTPhost.yourcompany.com -TO "recipient1@yourcompany.com; recipient2@yourcompany.com;recipient3@yourcompany.com" -FROM sender@yourcompany.com -SUBJECT "Generated Tableau View - Tableau Server Automated Alert System (TSAAS)" -ATTACH " C:\Program Files\Tableau\Tableau Command Line\progressReport.pdf" -BODY"this is the text of the body"
Note: For Tableau Server 8.1 through 8.3, ensure that you do not include the hash tag (#) and number at the end of the URL. For Tableau Server 9.0 and later, do not include ":iid=<n>."
If you install febootimail and review its help files, you can note the following:- Instead of typing the e-mail addresses of recipients using the TO tag, you can refer to a file.
- Instead of typing the e-mail body using the BODY tag, you can specify an HTMLFILE tag.
- You can attach multiple files.
Send formatted email with an embedded image
Tabcmd can generate PNG files, and febootimail.exe can send HTML e-mail. The febootimail help says that the HTML file must be in the same directory as febootimail.
Here is an example script:
tabcmd login -s http://tableauserver:80 -u admin -p admin
tabcmd get "/views/Wow/SummaryReports.png" -f "progressReport.png"
febootimail.exe -SMTP yourSMTPhost.yourcompany.com -TO "recipient1@yourcompany.com; recipient2@yourcompany.com;recipient3@yourcompany.com" -FROM sender@yourcompany.com -SUBJECT "Generated Tableau View - Tableau Server Automated Alert System (TSAAS)" - -HTMLFILE "emailbody.html"
Note: For Tableau Server 8.1 through 8.3, ensure that you do not include the hash tag (#) and number at the end of the URL. For Tableau Server 9.0 and later, do not include ":iid=<n>."
Notice that the BODY tag has been replaced by an HTMLFILE tag. Because tabcmd can auto-generate a PNG image, you can reference that image in the body of an HTML email template. Here is a simple version of this HTML file:<html>
<head><title>Email Alert</title></head>
<body><img src="progressReport.png"></body>
</html>
No comments:
Post a Comment