Home » Developer & Programmer » Reports & Discoverer » Oracle Reports
Oracle Reports [message #383773] Fri, 30 January 2009 01:09 Go to next message
Messages: 84
Registered: October 2008

Can somebody pls. advise if it's possible in Oracle Reports to hide/show cols. according to a condition (USING the SAME SELECT Statement)

For example:


I want to show COLA on the report for LIGHTS
I want to show COLB on the reports for BULBS

Re: Oracle Reports [message #383777 is a reply to message #383773] Fri, 30 January 2009 01:46 Go to previous message
Messages: 21148
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If I correctly understood the problem, one way might be using the CASE: for example, my "according to a condition" would be department number - if DEPTNO = 10 (your "lights"), display employee name; otherwise (your "bulbs") display job:
SQL> select deptno, ename, job,
  2         case
  3           when deptno = 10 then ename
  4           else job
  5         end display_col
  6  from emp
  7  where deptno in (10, 20)
  8  order by deptno;

---------- ---------- --------- ----------
        10 MILLER     CLERK     MILLER
        10 CLARK      MANAGER   CLARK
        10 KING       PRESIDENT KING
        20 FORD       ANALYST   ANALYST
        20 ADAMS      CLERK     CLERK
        20 JONES      MANAGER   MANAGER
        20 SMITH      CLERK     CLERK
        20 SCOTT      ANALYST   ANALYST

8 rows selected.


Another possibility might be writing a query just as you did, creating both fields in Paper Layout Editor, and writing Format Triggers for each of them.

COLA's Format trigger would look like
return (:your_parameter_name := 'LIGHTS');
while COLB's would be
return (:your_parameter_name := 'BULBS');

If none of these helps, could you, please, explain it once again? This time include a test case (CREATE TABLE and INSERT INTO sample data statements), as well as the desired output. Enclose the code into the [code] tags which will preserve formatting and make your code readable.
Previous Topic: Page Total /Carryforward Total for next Page?
Next Topic: Underline Employee name where hiredate is 21-dec-2008
Goto Forum:

Current Time: Tue Aug 22 02:18:13 CDT 2017

Total time taken to generate the page: 0.09028 seconds