Home » Developer & Programmer » Reports & Discoverer » Error on pressing hyperlink of the object in a report
Error on pressing hyperlink of the object in a report [message #552684] |
Fri, 27 April 2012 05:36 |
|
dhivyaenjoy
Messages: 49 Registered: June 2011
|
Member |
|
|
Hi,
I have a report where the Shipments list will appear.
The shipment_id appears as hyperlink and when it is pressed it should be redirected to another report which displays the cost details on the respective shipments
But we get an error message as in the attachment when i press the hyperlink.
Can anyone suggest me what would be the issue and where should i check for the error to resolve?
Also the query used to extract data is
/*select
decode(cost_type,
'B','Base',
'A','Accessorial',
'D','Discount',
'O','Other',
'S','Stop-off Charge',
'C','Circuity Charge',
cost_type) Cost_Type,
round(sum(Cost),2) Cost,
decode(cost_gid,'GBP','£','USD','$',cost_gid) curr_symbol
from shipment_cost
where &p_shipment_gid
group by Cost_Type,decode(cost_gid,'GBP','£','USD','$',cost_gid)*/
Thanks in advance
Regards
Dhivya
[MERGED by LF]
[Updated on: Wed, 02 May 2012 07:07] by Moderator Report message to a moderator
|
|
|
Re: Error on pressing hyperlink of the object in a report [message #552734 is a reply to message #552684] |
Fri, 27 April 2012 10:58 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Before posting your next message, please, spare a few seconds of your time and see how to format your code. I ran your query through a formatter and this the result. I'm sure that you agree that formatted code is much easier to read and follow.
SELECT Decode(cost_type, 'B', 'Base',
'A', 'Accessorial',
'D', 'Discount',
'O', 'Other',
'S', 'Stop-off Charge',
'C', 'Circuity Charge',
cost_type) Cost_Type,
Round(SUM(Cost), 2) Cost,
Decode(cost_gid, 'GBP', '£',
'USD', '$',
cost_gid) curr_symbol
FROM shipment_cost
WHERE &p_shipment_gid
GROUP BY Cost_Type,
Decode(cost_gid, 'GBP', '£',
'USD', '$',
cost_gid)
It appears that it is OK, but the problem might be in P_SHIPMENT_GID lexical parameter. How is it created? Check its value.
|
|
|
|
|
Re: Error on pressing hyperlink of the object in a report [message #552962 is a reply to message #552951] |
Mon, 30 April 2012 08:56 |
|
dhivyaenjoy
Messages: 49 Registered: June 2011
|
Member |
|
|
Hi,
Thanks for the reply.
The query in the first message belongs to the Second report which is the one that should be opened when we click the hyperlink.
Also there is attached library with the report and can you please advise me on compiling the library for the report.
Is it the same as we how we compile the report?
Also i want to bring to your notice that the first Parent report has a Format trigger defined for this particular variable as attached.
The value of Shipment_gid fetched will be like 'ORACL.12345678'
The value shipment_xid used in the attached trigger will be like '12345678' i.e substr(shipment_gid,7)
But both the variables shipment_gid and shipment_xid are Varchar2 in database and Character in Reports.
Will the attached Format trigger is fine or needs modification?
Please advise.
Regards,
Dhivya
[Updated on: Mon, 30 April 2012 09:05] Report message to a moderator
|
|
|
|
|
|
|
Re: Set lexical parameter [message #553163 is a reply to message #553161] |
Wed, 02 May 2012 07:21 |
cookiemonster
Messages: 13959 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
The problem isn't in vs =.
It's the number of quotes.
It always helps, when dealing with dynmaic sql, to output the dynamic string so you can see what it's done.
Watch:
SQL> DECLARE
2
3 P_SHIPMENT_GID VARCHAR2(50) := 'ABC';
4 BEGIN
5 IF NOT( P_SHIPMENT_GID IS NULL or P_SHIPMENT_GID = '1=1') then
6 P_SHIPMENT_GID := 'shipment_gid IN ('||P_SHIPMENT_GID||')' ;
7 ELSE
8 P_SHIPMENT_GID := '1=1' ;
9 END IF ;
10
11 dbms_output.put_line(P_SHIPMENT_GID);
12
13 END;
14 /
shipment_gid IN (ABC)
PL/SQL procedure successfully completed.
SQL>
Value is not in quotes so it's treated as a column name, which I assume it isn't.
SQL> DECLARE
2
3 P_SHIPMENT_GID VARCHAR2(50) := 'ABC';
4 BEGIN
5 IF NOT( P_SHIPMENT_GID IS NULL or P_SHIPMENT_GID = '1=1') then
6 P_SHIPMENT_GID := 'shipment_gid ='''||P_SHIPMENT_GID||'''' ;
7 ELSE
8 P_SHIPMENT_GID := '1=1' ;
9 END IF ;
10
11 dbms_output.put_line(P_SHIPMENT_GID);
12
13 END;
14 /
shipment_gid ='ABC'
PL/SQL procedure successfully completed.
SQL>
And that one's in quotes.
|
|
|
Re: Set lexical parameter [message #553164 is a reply to message #553161] |
Wed, 02 May 2012 07:29 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Lexical parameters are used in a SELECT statement.
Now, take it and supply the first lexical parameter's value into your query, then the second one, and see what happens.
Here's an example:
SQL> create or replace function fun_gid_equal (p_shipment_gid in varchar2)
2 return varchar2
3 is
4 retval varchar2(100);
5 begin
6 return 'shipment_gid ='''||P_SHIPMENT_GID||'''' ;
7 end;
8 /
Function created.
SQL> create or replace function fun_gid_in (p_shipment_gid in varchar2)
2 return varchar2
3 is
4 retval varchar2(100);
5 begin
6 return 'shipment_gid IN ('||P_SHIPMENT_GID||')' ;
7 end;
8 /
Function created.
SQL>
SQL> select
2 'where '|| fun_gid_equal('ORACL.12345678') result_equal,
3 'where '|| fun_gid_in('ORACL.12345678') result_in
4 from dual;
RESULT_EQUAL RESULT_IN
---------------------------------------- ----------------------------------------
where shipment_gid ='ORACL.12345678' where shipment_gid IN (ORACL.12345678)
SQL>
Obviously, your IN code is wrong (single quotes are missing).
P.S. Ooops! While I was composing my example, Cookiemonster posted his own. Never mind, I guess.
[Updated on: Wed, 02 May 2012 07:30] Report message to a moderator
|
|
|
|
|
Goto Forum:
Current Time: Sat Nov 30 06:46:44 CST 2024
|