Jorge Rimblas
Senior APEX Consultant
htp.p('<ul>');
for t in (
select id
, todo
, decode(completed_by
, null, ''
, 'check' || '-') checked
from app_todos
)
loop
htp.p('<li>'
|| t.todo
|| ' <i class="fa fa-'
|| t.checked || 'square-o">'
|| '</i>'
|| '</li>');
end loop;
htp.p('</ul>');
Classic Report examples
<td>
#COLUMN_VALUE#
</td>
<td class="t-Report-cell" #ALIGNMENT# headers="#COLUMN_HEADER_NAME#">
#COLUMN_VALUE#
</td>
select PRODUCT_ID
, PRODUCT_NAME
, PRODUCT_DESCRIPTION
, CATEGORY
, PRODUCT_AVAIL
, LIST_PRICE
from PRODUCTS
#PRODUCT_ID#
#PRODUCT_NAME#
#PRODUCT_DESCRIPTION#
#CATEGORY#
#PRODUCT_AVAIL#
#LIST_PRICE#
#COLUMN_VALUE#
select PRODUCT_ID
, PRODUCT_NAME
, PRODUCT_DESCRIPTION
, CATEGORY
, PRODUCT_AVAIL
, LIST_PRICE
from PRODUCTS
#1#
#2#
#3#
#4#
#5#
#6#
<ul>
<li>Orange Juice <i class="fa fa-check-square-o"></i></li>
<li>Milk <i class="fa fa-check-square-o"></i></li>
<li>Eggs <i class="fa fa-square-o"></i></li>
<li>Bread <i class="fa fa-square-o"></i></li>
<li>Cornflakes <i class="fa fa-square-o"></i></li>
</ul>
<li>#TODO# <i class="fa fa-#CHECKED#square-o"></i></li>
<ul>
</ul>
Before Rows
After Rows
<li>#TODO# <i class="fa fa-#CHECKED#square-o"></i></li>
select id
, todo
, decode(completed_by
, null, ''
, 'check' || '-') checked
, completed_by
, completed_on
from app_todos
Adding a link to edit
<tr>
<td colspan="2">
<a href="#LINK#">&EDIT_BUTTON.</a>
#PARTY_NAME# - #ROLE# <i class="fa"></i>
</td>
</tr>
<tr>
<td align="right">#TYPE_NAME#</td>
<td>#ENTRY#</td>
</tr>
<tr>
<td colspan="2">
<a href="#LINK#">&EDIT_BUTTON.</a>
#PARTY_NAME# - #ROLE# <i class="fa"></i>
</td>
</tr>
<tr>
<td align="right">#TYPE_NAME#</td>
<td>#ENTRY#</td>
</tr>
select party_id
, party_name
, role
, type_name
, entry
, active_ind
from parties
<tr>
<td colspan="2">
<a href="#LINK#">&EDIT_BUTTON.</a>
#PARTY_NAME# - #ROLE# <i class="fa"></i>
</td>
</tr>
<tr>
<td align="right">#TYPE_NAME#</td>
<td>#ENTRY#</td>
</tr>
select party_id
, party_name
, role
, type_name
, entry
, active_ind
from parties
where party_id = 41
Special Case
<function> (<arg1>, <arg2>, )
OVER (
< partition clause >
< sorting clause >
< windowing clause >
)
row_number()
over (
partition by party_id
order by party_name, entry
)
select party_id
, party_name
, entry
, row_number() over (
partition by party_id
order by party_name, entry) rn
from parties
PARTY_ID PARTY_NAME ENTRY RN
--------- ------------------ -------------------------------- -------
1 Scott, Michael 800 555-1212 1
1 Scott, Michael 952 555-1212 2
1 Scott, Michael michael.scott@dm.us 3
21 Schrute, Dwight 800 555-1212 1
21 Schrute, Dwight TheSilentNinja@SchruteFarms.com 2
21 Schrute, Dwight dschrute@dm.us 3
21 Schrute, Dwight ceo@SchruteFarms.com 4
41 Halpert, James D. 800 555-1212 1
8 rows selected.
select party_id
, party_name
, row_number() over (
partition by party_id
order by party_name, entry) rn
, count(*) over (
partition by party_id
) total_rows
from parties
PARTY_ID PARTY_NAME RN TOTAL_ROWS
--------- ------------------ --- -----------
1 Scott, Michael 1 3
1 Scott, Michael 2 3
1 Scott, Michael 3 3
21 Schrute, Dwight 1 4
21 Schrute, Dwight 2 4
21 Schrute, Dwight 3 4
21 Schrute, Dwight 4 4
41 Halpert, James D. 1 1
8 rows selected.
by Connor McDonald
select party_id
, party_name
, role
, type_name
, entry
, row_number() over (partition by party_id
order by party_name, entry) rn
from parties
:RN = 1
<tr>
<td colspan="2">
<a href="#LINK#">&EDIT_BUTTON.</a>
#PARTY_NAME# - #ROLE# <i class="fa"></i>
</td>
</tr>
<tr>
<td align="right">#TYPE_NAME#</td>
<td>#ENTRY#</td>
</tr>
<tr>
<td align="right">#TYPE_NAME#</td>
<td>#ENTRY#</td>
</tr>
Column Template 1
Column Template 2
<tr>
<td colspan="2">
<a href="#LINK#">&EDIT_BUTTON.</a>
#PARTY_NAME# - #ROLE# <i class="fa"></i>
</td>
</tr>
<tr>
<td align="right">#TYPE_NAME#</td>
<td>#ENTRY#</td>
</tr>
Column Template 1
Adding some markup
:RN = 1
<tr>
<td colspan="2">
<a href="#LINK#">&EDIT_BUTTON.</a>
#PARTY_NAME# - #ROLE# <i class="fa"></i>
</td>
</tr>
<tr>
<td align="right">#TYPE_NAME#</td>
<td>#ENTRY#</td>
</tr>
Column Template 1
<tr class="newContact rowStatus_#ACTIVE_IND#">
<td colspan="2" class="t-Report-cell heading">
<a href="#LINK#" class="contactEdit" data-id="#PARTY_ID#">&EDIT_BUTTON.</a>
<span class="name">#PARTY_NAME#</span> - <span class="roleName">#ROLE#</span>
<i class="fa cfa-check_#ACTIVE_IND# cfa-1_5x" title="#ACTIVE_IND#"></i>
</td>
</tr>
<tr>
<td align="right" class="t-Report-cell contactType">#TYPE_NAME#</td>
<td class="t-Report-cell contactEntry">#ENTRY#</td>
</tr>
Adding some markup
:RN = 1
<tr>
<td align="right">#TYPE_NAME#</td>
<td>#ENTRY#</td>
</tr>
Column Template 2
Detail View
Jorge Rimblas
apex.world Your one stop for everything APEX