1. Overview
This document gives an idea about the HTML template in AOP.
2. Technologies and Tools Used
The following technologies has been used to achieve exporting IR data to Word format.
- AOP
- HTML
- PLSQL
3. Use Case
HTML templates are perfect for sending HTML emails, creating HTML content for the web, or creating documents.
The advantage of exporting data in HTML format is that anyone can easily open it in a browser and no external software is required.
4. Architecture
Let’s see the sample template in html tags and source in the SQL. The template here contains loop tags for cursor orders and products, and a product column within the product cursor. For example, I have a template with the following content:
<p> Hello {cust_last_name} {cust_first_name}<br />
<p>This is the basic example of using loop tags.<br />
<p>{#orders}</p>
<table border=”1″ cellpadding=”1″ cellspacing=”1″ style=”width:100%”>
<tbody> <tr>
<td><strong>Product</strong></td>
<td><strong>Unit Price in €</strong></td>
<td><strong>Quantity</strong></td>
<td><strong>Extended Price in €</strong></td>
</tr>
<tr>
<td>{#product}{product_name}</td>
<td>{unit_price}</td>
<td><span style=”color:red”>{quantity}</span></td>
<td>{unit_price*quantity}{/product}</td>
</tr>
</tbody>
</table>
<p>{/orders}</p>
<p>Thank you for choosing AOP.</p>
<p>Best Regards</p>
<p>AOP Team</p>
Now, let’s see the how the source code should be for the above template SQL,
select ‘file1’ as “filename”,
cursor (
select c.cust_first_name as “cust_first_name”,
c.cust_last_name as “cust_last_name”,
c.cust_city as “cust_city”,
cursor (
select o.order_total as “order_total”,
‘Order ‘ || rownum as “order_name”,
cursor (
select p.product_name as “product_name”,
i.quantity as “quantity”,
i.unit_price as “unit_price”
from aop_sample_order_items i,
aop_sample_product_info p
where o.order_id = i.order_id
and i.product_id = p.product_id
) “product”
from aop_sample_orders o
where c.customer_id = o.customer_id
) “orders”
from aop_sample_customers c
where customer_id = 1
) as “data”
from dual;
When the above data source (for some products, the details of the product cursor are placed in another cursor called “orders”) is passed to AOP along with the given template, the output will be: