Out tag
Overview
An out tag is the most basic and most common tag. It tells the template to go to the data source, grab one piece of data – such as a number, a last name, an image, (and so on) – and place it in the template. Unless told otherwise, the out tag will retrieve one data item from the data group.
Use the out tag to display the contents of a node or variable in your report. The contents are formatted based on the attributes you set. The out tag can be used to display images in almost any format, including png, gif, tiff, jpg, bmp, dib, and more. The out tag is also used to display HTML by using type='TEMPLATE'.
If the location (that is, filename or URL) of the image or HTML is in the data source (and not the actual data itself), you would instead use the import tag.
Video: Creating a context-sensitive title page using Out tags
This video demonstrates how to create a context-sensitive title page using Out tags.
Let's see how this works in practice. Suppose you have a data group called "Contacts" that contains contact information for four people: Lisa, En-jay, Tomas and Kamala. That contact information is further organized into three subgroups: first name, last name, and city. Your template has three out tags, one for each of these subgroups.
Your template might have a table that looks like this:
Contacts |
||
First Name |
Last Name |
City |
<out tag> |
<out tag> |
<out tag> |
When you run your report, you would see something like this:
Contacts |
||
First Name |
Last Name |
City |
Lisa |
Harris |
Roma |
Note: Tags in templates typically have surrounding angle brackets that denote them as tags. You can change that by giving a tag a nickname, but we recommend you include angle brackets to make it easier to see what is a tag and what is plain text.
Attributes
One of these three attributes must be set:
- select – required (unless value or evaluate is set). Displays the contents of the selected node (field).
- value – required (unless select or evaluate is set). Displays the contents of a variable. Set this attribute to the name of the variable. (The data source is not accessed.)
- evaluate – required (unless select or value is set). Evaluates an expression and displays the result. Set this attribute to the expression. (The data source is not accessed.)
These attributes are optional:
- default – optional. Set this attribute to the text to insert into the report if the selected node (field) does not exist. If the node exists but is empty, nothing prints in the report. (An empty node is considered to exist.)
- type – optional. This involves the use of NumberFormat & DateFormat. This attribute defines both how the text in the node is parsed and how it is displayed. In both cases it uses the report locale (see the appendix for details) to parse and display the text. Numbers are parsed using DecimalFormat.parse(). Date/time can be in the SHORT, MEDIUM, LONG, or FULL format. They can also be a LONG used in the constructor for the Date class. (LONG is a "long integer" such as 123456, which is the number of milliseconds since 01-01-70.) Allowed values are:
- NUMBER - displays in the locale equivalent of 123,456.78
- CURRENCY - displays in the locale equivalent of $123,456.78 and ($123,456.78)
- PERCENT - displays in the locale equivalent of 55%
- DATE - displays the date in the locale-specific format. The node does not need a time in this case.
- TIME - displays the time in the locale-specific format. The node does not need a date in this case.
- BOTH - displays the date & time in the locale-specific format.
- BITMAP - the node data is assumed to be a uuencoded string of a file image for an imagefile. It will be uudecoded, read in as a bitmap, and placed in the report.
- TEMPLATE – used to insert HTML into a document. Use this when use to select the html in the database if it's actually in the database. (You use the import tag to select html in the database if only a filename/url is in the database. )
Limitations
In the case of value=, no intelligent parsing of the string occurs. It performs a simple text substitution for all ${variable} entries and then outputs the final value to the report. The string is not passed to the data source provider for evaluation. All of the optional attributes can be used in this case. For example, if value= is a number, it can be output as a currency or date.
Several attempts are made to parse the input string. (Parsing is when Autotag reads the text in the data source element and attempts to determine its value.) For a NUMBER/CURRENCY/PERCENT, it first attempts to parse the string using the appropriate NumberFormat.parse() method and using NumberFormat.applyPattern(). If this fails, it tries Double.parseDouble(). If that fails, it throws a NodeFormatException.
For DATE/TIME/BOTH six parsing passes occur. First, Autotag tries DateFormat.parse() using DateFormat.applyPattern(). If that fails, it triesDateFormat.parse() using the patterns FULL, LONG, MEDIUM and SHORT without using applyPattern(). If that fails, it assumes the data is a LONG and tries DATE (Long.parseLong()) which is the number of milliseconds since 01-01-1970. If it is not a LONG, it throws a NumberFormatException.
For more information on patterns and parsing, please view the java documentation for the java classes DateFormat, DecimalFormat, NumberFormat, and SimpleDateFormat.
Supported HTML and CSS for Type="Template"
Autotag supports a limited subset of HTML 4.01 for use in templates. The supported tags, attributes, and units/formats are listed below.
Supported Tags and Attributes
Tag |
HTML Attributes |
CSS Attributes |
---|---|---|
<a> |
href, style |
color, font-size |
<b> |
style |
color, font-size |
<body> |
style |
color, font-size |
<br/> |
|
|
<em> |
style |
color, font-size |
<font> |
color, face, size, style |
color, font-size |
<i> |
style |
color, font-size |
<img/> |
alt, src |
|
<li> |
style |
color, font-size |
<ol> |
style |
color, font-size |
<p> |
align, class, style |
color, font-size |
<strike> |
style |
color, font-size |
<strong> |
style |
color, font-size |
<sub> |
style |
color, font-size |
<sup> |
style |
color, font-size |
<table> |
border, style, width |
color, font-size, width |
<tr> |
|
|
<td> |
colspan, rowspan, style, width |
color, font-size, width |
<u> |
style |
color, font-size |
<ul> |
style |
color, font-size |
Supported Formats for HTML Attributes
HTML Attribute |
Supported Formats |
---|---|
alt |
|
align |
|
border |
|
class |
|
color |
|
colspan |
|
face |
|
href |
|
rowspan |
|
size |
|
src |
|
style |
|
width |
|
CSS Attribute |
Supported Formats |
---|---|
color |
|
font-size |
|
width |
|