1- Create your report
In this report we're using the employees percentage of salary within their department
SELECT e.ename,
e.job,
d.dname,
e.sal,
ROUND (e.sal / SUM (e.sal) OVER (PARTITION BY e.deptno) * 100, 0) pct_dep_sal,
ROUND (e.sal / SUM (e.sal) OVER (PARTITION BY e.deptno) * 100, 0) bar
FROM emp e,
dept d
WHERE e.deptno = d.deptno
2- Add Percentage Bar for the "bar" column
- In the Reports Attributes section, click on the "Bar" column attributes
- Under Number/Date formatting enter the following: PCT_GRAPH:330099:CC0000:100
PCT_GRAPH:<Hex background color>:<Hex foreground color>:<Bar width in pixels>
Cool! I like it.
ReplyDeleteWhere did you find information about this feature?
Hi Louis,
ReplyDeleteI can't remember exactly where I found it but a long time ago I either asked about it on the forum or Scott Spendolini told me about it.
I completely forgot about it until last week so I thought that I'd write about it since I couldn't find anything on the forums.
Maybe it was here: http://www.inside-oracle-apex.com/more-undocumented-new-features-in-oracle-apex-31/#high_2
ReplyDelete;)
But it definitely deserves repeating.
Joel
Hi Joel,
ReplyDeleteI don't like to copy other peoples post, so thanks for pointing that out. I didn't realize their was a pl/sql procedure for it as well.
Thanks,
Martin
Excellent example
ReplyDeleteI don't necessarily need it, but it's very neat and comes in handy! Already implemented it into my app!
ReplyDeleteThanks for posting it!
Hi,
ReplyDeleteThank you for the solution, its working fine in my report,but can I display the Percentage value in the graph itself or something like Tool Tip in the report column?
If you're using APEX 5 check out the Sample Application. On the first page there's an excellent demo on how to do the tooltip in a report. I believe is a lugin region.
Delete