Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to conditionally put a percentage sign in a column in a report

625614Feb 4 2009 — edited Feb 9 2009
Background: In the past, our users have been provided with a spreadsheet of statistics that was created manually, by running a bunch of barely related queries, manually entering the data into the spreadsheet, adding formatting and headings, etc. They wanted this moved to APEX, and they wanted to be able to export it as one spreadsheet. The only way I could find to do this was to combine all the queries into one huge query.

So I have a report of 22 unique queries unioned together. The third and fifth columns are percentages. I found this post that explained how to use the HTML Expression (under Column Attributes) to add a percentage sign (#COL03#%).
This worked fine except for that in order to get the headings how they wanted them, I had to do something like:
-statistical query-
union all
select '<b>HEADING ONE</b>', null, null, null, null from dual
union all
-statistical query-
etc.

The problem now is that I don't actually want the percentage sign in the heading rows. Is there a way to change the HTML Expression so it's conditional, and it only appends the percentage sign if the value in that row is not null? Or alternately, is there a way to append the percentage sign in the actual select statement, so I could go through each of my 22 queries and append it only when I know it's needed? A simple example of one of these queries is:
select ''New Enrollees'' as a,
(count(case when extract(month from rdate) = :P45_MONTH_SELECT THEN 1 else NULL END)) as monthly,
(((count(case when extract(month from rdate) = :P45_MONTH_SELECT THEN 1 else NULL END))/:P45_TOTAL_MON_SUBMISSIONS)*100) as m,
(count(case when extract(month from rdate) <= :P45_MONTH_SELECT THEN 1 else NULL END)) as YTD,
(((count(case when extract(month from rdate) <= :P45_MONTH_SELECT THEN 1 else NULL END))/:P45_TOTAL_SUBMISSIONS)*100) as y
from main
where extract(year from rdate) = :P45_YEAR_SELECT

Thanks in advance for your help!

-Gaso

Edited by: gaso on Feb 4, 2009 1:39 PM

Edited by: gaso on Feb 9, 2009 4:39 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 9 2009
Added on Feb 4 2009
1 comment
680 views