Introduction
This article describes how to use the HTML held in a database in your Format as HTML Pro
The Format as HTML Pro tool is used to create a task step that produces single or multiple HTML documents. You can choose to create the HTML template from scratch or import a pre-existing template. Recordsets and other task step properties can also be used to populate the HTML document to product dynamic content documents. These documents can then be consumed and then delivered by Output or Execute task steps. template.
Scenario
Because of the flexible nature of BPA Platform, we will use the example of creating an HTML email template to demonstrate how to use HTML stored in a database. This HTML contains an email footer for all emails sent.
Required Tools
| ► | Format as HTML Pro |
The following procedure assumes the following:
| ► | You have created a global connection to the relevant database using either Database Query tool |
| ► | You have created a global connection to the relevant SMTP server to send the emails |
Creating the Task
This procedure focuses on the configuration required to use HTML from a database when creating templates in the Format as HTML Pro tool.
The Format as HTML Pro Step
To use HTML stored in a database in your Format as HTML Pro template, do the following:
- Create a new task.
- Add a Database Query step to retrieve the data to populate your template.
- Add a Database Query step to retrieve the fields containing the HTML — even when your HTML fields are in the same database as the template data, you should separate this out into a different recordset.
- Add a Format as HTML Pro step and configure the HTML template as required by your task.
- Still in the Format as HTML Pro step, go back to the Data tab.
- From the Input Recordsets pane, drag the recordset containing the HTML fields to the Structure pane so it becomes a child node to Document:
- Go to the Design tab.
- In the Structure pane, select the new HTML results node.
- In the Fields pane, select the field that contains the required HTML.
- From the Field Properties pane, expand Format and set Raw to True.
This forces the Format as HTML Pro tool to treat anything in this field as raw HTML rather than as plain text (default), that is, render
<strong>Hello World</strong>as Hello World in the eventual output, rather than outputted exactly as seen in the recordset.
- In the HTML design area, add the following HTML to the relevant location in the HTML template:
<div class="-bpa-fah-row-"></div>For this exercise, we're adding it to the bottom of the template as this is the email footer.
- From the Structure pane, drag the new HTML results node to the HTML design area and drop it between
row-and the closing">in the openingdivelement. - Select Node ID from the resultant pop-up menu.
- From the Fields pane, drag the field containing the HTML to the HTML design area and drop it between the opening and closing
divelements.Your HTML document should look like this now:

This
divis just a container for the HTML extracted from the database; it plays no part in the formatting of the HTML. The BPA Platform-specific class indicates which recordset the field belongs to. For more information about available BPA Platform-specific classes, see A Note About the BPA Platform-Specific HTML Classes. - Click OK to save and close this step.
- Add a Send Email (SMTP) step to the task which consumes the Format as HTML Pro step and uses this as the Document Output.
- Connect your steps so the task looks like:
Now when the task is run, the HTML is added as a static element to the end of the HTML email sent.
For the purposes of this exercise, we have used a single HTML field; you can expand this to include as many fields as required.