<< Click to Display Table of Contents >> Navigation: Delphi HTML Report Library > Tables > Output non-tabular data |
DATAPACKET could be used to display non-tabular data like lists or labels. In this case templates should be used with custom =true parameter, which removes the framing tags <table> and <tr> and allowing to define full structure of a data.
Consider output a simple list of customers:
<DATAPACKET>
<METADATA>
<SQL>
select * from customer
</SQL>
</METADATA>
<template-table custom=”true”>
<ul>
{{#rows}}
<li>{{COMPANY}}</li>
{{/rows}}
</ul>
</template-table>
</DATAPACKET>
Result:
• Kauai Dive Shoppe
• Unisco
• Sight Diver
• Cayman Divers World Unlimited
• Tom Sawyer Diving Centre
• Blue Jack Aqua Center
More complex template:
<DATAPACKET>
<METADATA>
<SQL>
select * from biolife
</SQL>
</METADATA>
<template-table custom="true">
{{#rows}}
<div style="border: solid silver 1px; padding: 10 10; margin: 10 10">
Category: <b>{{CATEGORY}}</b><br>
Common Name: <b>{{COMMON_NAME}}</b><br>
Length: <b>{{LENGTH__CM_}}</b><br>
</div>
{{/rows}}
</template-table>
</DATAPACKET>
Result:
By default, template-table contains
{{{header}}} {{{body}}}
And for custom templates
<table {{{attributes}}}>
{{{header}}}
{{{body}}}
</table>
Also XML object created by datapacket (like any other XML report object) can be used to produce non-tabular HTML. Example:
Consider we have datapacket with name="mypacket".
After this datapacket following section can be placed:
<ul>
{{#mypacket.ROWDATA}}
<li>{{NAME}}</li>
{{/mypacket.ROWDATA}}
</ul>