General
Count Tags
The "count tag" output type on AOP provides a count of each tag used within a template, displaying the number of occurrences for each tag.
Note: Do not forget to set the output type as Count Tags
to utilize this feature.
Example:
Below is a sample template image and its output in JSON format, showcasing how each tag and its count are displayed.
Count Tag Output:
"{cust_first_name}": 1,
"{cust_last_name}": 1,
"{cust_city}": 1,
"{#orders}": 1,
"{order_name}": 1,
"{#product}": 1,
"{product_name}": 1,
"{quantity}": 1,
"{unit_price}": 1,
"{%image}": 1,
"{/product}": 1,
"{order_total}": 1,
"{/orders}": 1
}
Each tag used in the template is listed with a count of 1, indicating it appears only once within the template.
PDF Document Properties
Every document has properties such as title
,tags
,created date
,modified date
, and comments
.
With AOP, you can dynamically assign this documentation information to a document directly within the data.
You can provide data for the title, tags, and comments directly from the data source.
However, you need to provide the created date and modified date on INIT PL/SQL region.
- INIT/PLSQL Option
- JSON Option
aop_api_pkg.g_output_modified_date := '2024/11/11';
aop_api_pkg.g_output_created_date := '2024/10/11';
{
"output": {
"output_type": "date_information",
"output_modified_date": "2024/11/11",
"output_created_date": "2024/10/11"
}
}
Note: The created and modified dates are set manually for user convenience, allowing users to adjust the dates as they prefer.
EXAMPLE USAGE:
- SQL
- PL/SQL returning SQL
- PL/SQL returning JSON
- JSON
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",
c.cust_last_name || ' Order_summary' as "title",
'Order' as "tag",
'product_name' as "comment",
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",
p.category as "category",
'true' as "category_group"
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
order by p.category asc
) "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;
declare
l_return clob;
begin
l_return := q'[
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",
c.cust_last_name || ' Order_summary' as "title",
'Order' as "tag",
'product_name' as "comment",
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",
p.category as "category",
'true' as "category_group"
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
order by p.category asc
) "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;
]';
return l_return;
end;
declare
l_cursor sys_refcursor;
l_return clob; -- can also be varchar2, make sure it corresponds to the structure in the JSON
begin
apex_json.initialize_clob_output(dbms_lob.call, true, 2);
open l_cursor for
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",
c.cust_last_name || ' Order_summary' as "title",
'Order' as "tag",
'product_name' as "comment",
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",
p.category as "category",
'true' as "category_group"
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
order by p.category asc
) "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;
apex_json.write(l_cursor);
l_return := apex_json.get_clob_output;
return l_return;
end;
[
{
"filename": "file1",
"data": [
{
"cust_first_name": "John",
"cust_last_name": "Dulles",
"cust_city": "Sterling",
"title": "Dulles Order_summary",
"tag": "Order",
"comment": "product_name",
"orders": [
{
"order_total": 2380,
"order_name": "Order 1",
"product": [
{
"product_name": "Bag",
"quantity": 4,
"unit_price": 125,
"category": "Accessories",
"category_group": true
},
{
"product_name": "Wallet",
"quantity": 2,
"unit_price": 50,
"category": "Accessories",
"category_group": true
},
{
"product_name": "Belt",
"quantity": 2,
"unit_price": 30,
"category": "Accessories",
"category_group": true
},
{
"product_name": "Mens Shoes",
"quantity": 2,
"unit_price": 110,
"category": "Mens",
"category_group": true
},
{
"product_name": "Jacket",
"quantity": 3,
"unit_price": 150,
"category": "Mens",
"category_group": true
},
{
"product_name": "Business Shirt",
"quantity": 3,
"unit_price": 50,
"category": "Mens",
"category_group": true
},
{
"product_name": "Trousers",
"quantity": 3,
"unit_price": 80,
"category": "Mens",
"category_group": true
},
{
"product_name": "Ladies Shoes",
"quantity": 2,
"unit_price": 120,
"category": "Womens",
"category_group": true
},
{
"product_name": "Blouse",
"quantity": 3,
"unit_price": 60,
"category": "Womens",
"category_group": true
},
{
"product_name": "Skirt",
"quantity": 3,
"unit_price": 80,
"category": "Womens",
"category_group": true
}
]
}
]
}
]
}
]
Sample template image for documentation information