Multiple Columns in Param Form [message #556486] |
Mon, 04 June 2012 12:46 |
|
TX_developer
Messages: 46 Registered: July 2011
|
Member |
|
|
Hi,
I am adding a parameter to the parameter form of existing reports based on a select statement and has two columns. That part is fine. However, Oracle reports is adding a dash between the two values. Still fine, but I am also adding a UNION with ALL in case the user wants to run the report for all values. In the Parameter form it looks like this:
ALL -
RBC - 111
RRG - 234
TEB - 445
How do I get rid of the dash for "ALL" since I did not physically add it?
Below is my select statement for the parameter I created:
SELECT code,
code_num
FROM codes
WHERE code_num <> 0
UNION
SELECT 'ALL', ' '
FROM dual
ORDER BY 1;
Thank you,
~k
|
|
|
|
|
|
Re: Multiple Columns in Param Form [message #556588 is a reply to message #556586] |
Tue, 05 June 2012 09:21 |
|
TX_developer
Messages: 46 Registered: July 2011
|
Member |
|
|
Here is my report query.
SELECT ca.credit_amt,
ca.debit_amt,
ca.create_date,
ca.transaction_type
ca.code,
ca.code_num
FROM cold_accounts ca,
codes c
WHERE TRUNC(ca.create_date) BETWEEN UPPER(TRUNC(:create_date_from)) AND UPPER(TRUNC(:create_date_to))
AND ca.code = c.code
AND ca.code_num = c.code_num
AND c.code_num <> 0
AND ca.code DECODE(:p_code, 'ALL', c.code,
:p_code);
The select for the :p_code parameter is
SELECT code,
code||' - '||code_num
FROM codes
WHERE code_num <> 0
UNION
SELECT 'ALL', 'ALL'
FROM dual
ORDER BY 1;
I am hiding the first column.
Thank you,
~k
|
|
|
Re: Multiple Columns in Param Form [message #556686 is a reply to message #556588] |
Wed, 06 June 2012 01:43 |
ranamirfan
Messages: 535 Registered: January 2006 Location: Pakistan / Saudi Arabia
|
Senior Member |
|
|
Dear,
Create Lexical parameter
SELECT ca.credit_amt,
ca.debit_amt,
ca.create_date,
ca.transaction_type
ca.code,
ca.code_num
FROM cold_accounts ca,
codes c
WHERE TRUNC(ca.create_date) BETWEEN UPPER(TRUNC(:create_date_from)) AND UPPER(TRUNC(:create_date_to))
AND ca.code = c.code
AND ca.code_num = c.code_num
&user_param_value
Go to report user parameter - create another parameter user_param_list with datatype number
click user_param_list - List of values and add this below code in Select Statement also hide first column.
The value for the :user_param_value as following.
SELECT code,
code||' - '||code_num
FROM codes
WHERE code_num <> 0
UNION
SELECT 777,'ALL'
FROM dual
ORDER BY 1;
After that go to Report triggers BEFORE REPORT Click it and add this below code.
BEGIN
IF :user_param_list = 777 THEN
:user_param_value :='AND CA.CODE IS NOT NULL';
ELSE
:user_param_value :='AND CA.CODE='||:user_param_list;
END IF;
RETURN TRUE;
END;
Try this.
Regards,
Irfan
|
|
|
|
|
Re: Multiple Columns in Param Form [message #556835 is a reply to message #556824] |
Wed, 06 June 2012 18:05 |
|
TX_developer
Messages: 46 Registered: July 2011
|
Member |
|
|
Thanks Littlefoot...just making sure. It appears that Oracle reports uses the first column in the parameter form query as the parameter value. I figured hiding it would not change that.
Appreciate all the feedback. I am still learning as I go along.
Thanks,
~k
|
|
|