Oracle Reports [message #383773] |
Fri, 30 January 2009 01:09 |
Maverick27
Messages: 84 Registered: October 2008
|
Member |
|
|
Hi,
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:
SELECT COLA, COLB
FROM TABLE
WHERE............
I want to show COLA on the report for LIGHTS
I want to show COLB on the reports for BULBS
Mave
|
|
|
Re: Oracle Reports [message #383777 is a reply to message #383773] |
Fri, 30 January 2009 01:46 |
|
Littlefoot
Messages: 21823 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;
DEPTNO ENAME JOB DISPLAY_CO
---------- ---------- --------- ----------
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.
SQL>
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 likereturn (:your_parameter_name := 'LIGHTS'); while COLB's would bereturn (: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.
|
|
|