Reinventing APEX Reporting
It's all about changing your reporting state of mind. I used to automatically associate reporting to something like this:
You know the drill, a few HTML tags such as <table>
, <tr>
, <th>
, <td>
, etc. I wish we could make standard reports more interesting...
Hold on...
Do you know what "Named Column (row)" templates are? They've been around in APEX since like...forever.
I used to think it was bad practice to have row templates. Now I believe it is the most powerful feature for designing dynamic content.
Here are a few examples of 100% legitimate reports in APEX:
1) Cards Report
2) Collection Report
3) Slider Report
4) Standard Report (but clean)
5) News Report
6) Jobs Report
All the examples above uses a <div>
based HTML structure.
So let's create one for that matter...
Row templates uses your named column aliases as a placeholder in your template's HTML. In the code below, #IMG#
, #TITLE#
, #CONTENT#
, #BTN_LINK_1#
and #BTN_LABEL_1#
are actual column aliases in my SQL query.
Row Template HTML Markup
<div class="#COLUMN_CSS_CLASSES#">
<div class="card">
<div class="card-image">
#IMG#
<span class="card-title">#TITLE#</span>
</div>
<div class="card-content">
#CONTENT#
</div>
<div class="card-action">
<p>
<a href="#BTN_LINK_1#">#BTN_LABEL_1#</a>
</p>
</div>
</div>
</div>
Report SQL query
SELECT 'col m6' column_css_classes
,'<img src="picture1.jpg">' img
,'Card Title' title
,'I am a very simple card. I am good at...' content
,'#' btn_link_1
,'This is a link' btn_label_1
FROM dual
UNION
SELECT 'col m6'
,'<img src="picture2.jpg">' img
,'Card Title' title
,'I am a very simple card. I am good at...' content
,'#' btn_link_1
,'This is a link' btn_label_1
FROM dual
So don't be afraid to use row templates, they are truly useful for making your applications a bit more unique.