Dublicate Value In HTML PL/SQL Report
hi,
i have to enter item name and item Price iinto transaction_details by using a form and labour Work, labour amount into LAB_WORK_DTL table using a form .
Now Problem is when i fetch these value in to PL/SQL Report then it's shows me double value like My Total Amount is 100 Then It show Me 200 and if there is two Values eg A , B then in report it's shows me A ,B , A, B, these two Value Shows Me in four Rows .How can i remove Dublicate Values .Why it does show me that double value . My code is below
How can i remove this problem .
declare
SA NUMBER;
tot number;
TH NUMBER;
va number;
am number;
lst number;
tst number;
st NUMBER;
cursor c2 is select
T.VAT,
SUM(T.AMOUNT) AMOUNT,
SUM(T.VAT_AMOUNT) VAT_AMOUNT
from transaction_details T FULL JOIN LAB_WORK_DTL L
ON T.BILL_NO = L.BILL_NO
WHERE T.BILL_NO = :P27_BILL_NO
GROUP BY T.bill_no,t.vat, T.bill_date, T.vehicle_no, T.PARTY_NAME;
BEGIN
FOR x IN(SELECT t.item_name, t.qty,t.rate, t.bill_no
FROM transaction_details t,LAB_WORK_DTL l where t.bill_no=l.bill_no(+) and t.bill_no=:p27_bill_no
LOOP
HTP.P('<tr>
<td width="2%"> </td>
<td width="55%" align="left"> '|| HTF.escape_sc (x.item_name)||'</td>
<td width="15%" ALIGN="right">'|| HTF.escape_sc (x.qty)||'</td>
<td width="15%" ALIGN="right">'|| HTF.escape_sc (x.rate)||'</td>
<td width="25%" ALIGN="right">'|| HTF.escape_sc (x.qty)* HTF.escape_sc (x.rate)||'
</td>
</tr>');
END LOOP;
tot:=0;
bc:=0;
KA:=0;
open c2;
loop
FETCH c2 INTO va,am,vat_am;
exit when c2%notfound;
tot:=nvl(tot+am,0);
bc:=nvl(bc+vat_am,0);
end loop;
close c2;
HTP.P('<tr>
<td width="38"> </td>
<td width="29"> </td>
<td width="447"> </td>
<td> </td>
<td width="173">
<p align="Right">-------------------</td>
</tr>
<tr>
<td width="38"> </td>
<td width="447"> TOTAL</td>
<td> </td>
<td width="95"></td>
<td width="172">
<p align="right">'
|| nvl(HTF.escape_sc (tot),0)
||'</td>
</tr>');
</table></body>
</html>');
END;
Thanks
Manoj Kaushik
Edited by: Manoj Kaushik on Apr 8, 2010 11:01 PM
hi,
this is my Complete Code But I facing Dublicate Value Error .
In that Code In Total Amount Of All Item Price Show me Jus Double.
How Can I remove it.
declare
a number;
bd date;
b varchar2(20);
c varchar2(50);
d varchar2(50);
e varchar2(50);
f varchar2(50);
g varchar2(50);
h varchar2(4000);
la NUMBER;
p NUMBER;
SA NUMBER;
K NUMBER;
FA NUMBER;
HA NUMBER;
KA NUMBER;
KH NUMBER;
MA NUMBER;
cnt NUMBER;
tot number;
l number;
TH NUMBER;
FS NUMBER;
va number;
am number;
vat_am number;
bc NUMBER;
lst number;
tst number;
st NUMBER;
c_tra number;
c_lab number;
cursor c1 is select T.bill_no,T.bill_date,T.vehicle_no,T.PARTY_NAME
from transaction_details T FULL JOIN LAB_WORK_DTL L
ON T.BILL_NO = L.BILL_NO
WHERE T.BILL_NO = :P27_BILL_NO
GROUP BY T.bill_no, T.bill_date, T.vehicle_no, T.PARTY_NAME;
cursor c2 is select
T.VAT,
SUM(T.AMOUNT) AMOUNT,
SUM(T.VAT_AMOUNT) VAT_AMOUNT
from transaction_details T FULL JOIN LAB_WORK_DTL L
ON T.BILL_NO = L.BILL_NO
WHERE T.BILL_NO = :P27_BILL_NO
GROUP BY T.bill_no,t.vat, T.bill_date, T.vehicle_no, T.PARTY_NAME;
cursor c3 is select L.service_tax,SUM(L.LABOUR_AMT) LABOUR_AMT,
SUM(L.SERVICE_TAX_AMT) SERVICE_TAX_AMT
from transaction_details T FULL JOIN LAB_WORK_DTL L
ON T.BILL_NO = L.BILL_NO
WHERE T.BILL_NO = :P27_BILL_NO
GROUP BY T.bill_no,L.service_tax, T.bill_date, T.vehicle_no, T.PARTY_NAME;
cursor c4 is select
T.VAT,
SUM(T.AMOUNT) AMOUNT,
SUM(T.VAT_AMOUNT) VAT_AMOUNT
from transaction_details T FULL JOIN LAB_WORK_DTL L
ON T.BILL_NO = L.BILL_NO
WHERE T.BILL_NO = :P27_BILL_NO
GROUP BY T.bill_no,t.vat, T.bill_date, T.vehicle_no, T.PARTY_NAME;
cursor c5 is select L.service_tax,SUM(L.LABOUR_AMT) LABOUR_AMT,
SUM(L.SERVICE_TAX_AMT) SERVICE_TAX_AMT
from transaction_details T FULL JOIN LAB_WORK_DTL L
ON T.BILL_NO = L.BILL_NO
WHERE T.BILL_NO = :P27_BILL_NO
GROUP BY T.bill_no,L.service_tax, T.bill_date, T.vehicle_no, T.PARTY_NAME;
BEGIN
select chasis_no,ENGINE_NO,MAKE,MILEAGE into c,d,e,f from VEHICLE_DETAILS where vehicle_no =:P27_VEHICLE_NO;
select ADDRESS into h from PARTY_DETAILS where PARTY_NAME =:p27_PARTY_NAME;
open c1;
FETCH c1 INTO a,bd,b,g;
htp.p('<html>
<body leftmargin="0" rightmargin="0">
<table border="1" width="100%" bordercolorlight="#003366" cellspacing="0" bordercolordark="#003366" id="table1">
<tr>
<td colspan="2">
<table border="1" width="100%" cellspacing="0" cellpadding="0" id="table3">
<tr>
<td width="50"> </td>
<td width="21"> </td>
<td> </td>
</tr>
<tr>
<td width="50"><b>
</b></td>
<td width="21"><b></b></td>
<td align ="left">
<font size="4" face="Arial Black">'||HTF.escape_sc(g)||'</font></td>
</tr>
<tr>
<td width="50"> </td>
<td width="21"> </td>
<td> </td>
</tr>
<tr>
<td width="50"><b>
</b></td>
<td width="60"><b></b></td>
<td rowspan="4">
<font size="4" face="Arial Black">'||HTF.escape_sc(h)||'</font></td>
</tr>
<tr>
<td width="50"> </td>
<td width="21"> </td>
</tr>
<tr>
<td width="50"> </td>
<td width="21"> </td>
</tr>
<tr>
<td width="50"> </td>
<td width="21"> </td>
</tr>
</table>
</td>
<td width="44%" colspan="3">
<table border="1" width="100%" cellspacing="0" cellpadding="0" id="table4">
<tr>
<td width="53"> </td>
<td width="104"><b></b></td>
<td width="10"></td>
<td ><font size="5" face="Arial Black"> ' || HTF.escape_sc(a) ||'</font> </td>
</tr>
<tr>
<td width="53"> </td>
<td width="104"><b></b></td>
<td width="10"></td>
<td ><font size="5" face="Arial Black"> ' || HTF.escape_sc(bd) ||'</font></td>
</tr>
<tr>
<td width="53"> </td>
<td width="104"><b>
</b></td>
<td width="10"></td>
<td ><font size="5" face="Arial Black"> '|| HTF.escape_sc(b) ||'</font> </td>
</tr>');
CLOSE c1;
htp.p('<tr>
<td width="53"> </td>
<td width="104"><b>
</b></td>
<td width="10"></td>
<td ><font size="5" face="Arial Black"> ' || HTF.escape_sc (c) ||'</font></td>
</tr>
<tr>
<td width="53"> </td>
<td width="104"><b>
</b></td>
<td width="10"><b></b></td>
<td ><font size="5" face="Arial Black"> ' || HTF.escape_sc (d) ||'</font></td>
</tr>
<tr>
<td width="53"> </td>
<td width="104"><b>
</b></td>
<td width="10"><b></b></td>
<td ><font size="5" face="Arial Black"> ' || HTF.escape_sc (e) ||'</font></td>
</tr>
<tr>
<td width="53"> </td>
<td width="104"><b>
</b></td>
<td width="10"><b></b></td>
<td ><font size="5" face="Arial Black"> ' || HTF.escape_sc (f) ||'</font></td>
</tr>
</TABLE>
</td>
</tr>
<tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
<tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
select count(*) into c_tra from transaction_details where bill_no=:p27_bill_no;
select count(*) into c_lab from lab_work_dtl where bill_no=:p27_bill_no;
if c_tra>0 and c_lab=NULL then
FOR x IN(SELECT distinct t.item_name, t.qty,t.rate, t.bill_no
FROM transaction_details t,LAB_WORK_DTL l where t.bill_no=l.bill_no(+) and t.bill_no=:p27_bill_no
LOOP
HTP.P('<tr>
<td width="2%"> </td>
<td width="55%" align="left"> '|| HTF.escape_sc (x.item_name)||'</td>
<td width="15%" ALIGN="right">'|| HTF.escape_sc (x.qty)||'</td>
<td width="15%" ALIGN="right">'|| HTF.escape_sc (x.rate)||'</td>
<td width="25%" ALIGN="right">'|| HTF.escape_sc (x.qty)* HTF.escape_sc (x.rate)||'
</td>
</tr>');
END LOOP;
tot:=0;
bc:=0;
KA:=0;
open c2;
loop
FETCH c2 INTO va,am,vat_am;
exit when c2%notfound;
tot:=nvl(tot+am,0);
bc:=nvl(bc+vat_am,0);
end loop;
close c2;
KA :=nvl(tot+bc,0);
HTP.P('<tr>
<td width="38"> </td>
<td width="29"> </td>
<td width="447"> </td>
<td> </td>
<td width="173">
<p align="Right">-------------------</td>
</tr>
<tr>
<td width="38"> </td>
<td width="447"> TOTAL</td>
<td> </td>
<td width="95"></td>
<td width="172">
<p align="right">'
|| nvl(HTF.escape_sc (tot),0)
||'</td>
</tr>');
open c4;
loop
FETCH c4 INTO va,am,vat_am;
exit when c4%notfound;
HTP.P('<tr>
<td width="38"> </td>
<td width="446"> VAT '||nvl(HTF.escape_sc (va),0)||'% OF Rs.'||nvl(HTF.escape_sc (am),0)||'</td>
<td width="116"> </td>
<td></td>
<td width="172">
<p align="right">'
|| nvl(HTF.escape_sc (vat_am),0)
||'</td>
</tr>');
end loop;
CLOSE c4;
HTP.P('<tr>
<td> </td>
<td width="30"> </td>
<td width="118"> </td>
<td width="95"> </td>
<td width="173">
<p align="Right">------------------</td>
</tr>
<tr>
<td> </td>
<td width="446" align="left"> TOTAL</td>
<td width="118"> </td>
<td width="95"></td>
<td width="173">
<p align="right">'
|| nvl(HTF.escape_sc (KA),0)
||'</td>
</tr>
<tr>
<td> </td>
<td width="446" align="left"> LABOUR CHARGES :-</td>
<td width="118"> </td>
<td width="95"></td>
<TD width="173"></td>
</tr>');
elsif c_lab>0 and c_tra=NULL THEN
FOR Y IN(SELECT l.WORK_DETAIL,l.LABOUR_AMT
FROM transaction_details t,LAB_WORK_DTL l WHERE t.bill_no(+) =l.bill_no and l.bill_no =:P27_BILL_NO
LOOP
HTP.P('<tr>
<td> </td>
<td width="446" align="left"> '||nvl(HTF.escape_sc (Y.WORK_DETAIL),0)||'</td>
<td width="118"> </td>
<td width="95"></td>
<td width="173">
<p align="right">'|| nvl(HTF.escape_sc(Y.LABOUR_AMT),0)||'</td>
</tr>');
END LOOP;
HTP.P('
<TR>
<td> </td>
<td width="30"> </td>
<td width="118"> </td>
<td width="95"></td>
<td width="173"> </td>
</tr>');
HTP.p ( '<tr>
<td width="36"> </td>
<td width="445"> </td>
<td> </td>
<td width="97"> </td>
<td width="172">
<p align="Right">------------------</td>
</tr>');
sa:=0;
lst:=0;
open c3;
loop
FETCH c3 INTO st,la,p;
exit when c3%notfound;
sa:=nvl(sa+la,0);
lst:=nvl(lst+p,0);
end loop;
close c3;
TH:=nvl(sa+lst,0);
FS:=KA+TH;
htp.p('<tr>
<td width="36"> </td>
<td width="445"> TOTAL</td>
<td> </td>
<td width="97"></td>
<td width="172">
<p align="right">'
||nvl(ROUND(HTF.escape_sc (sa),2),0)
||'</td>
</tr>');
open c5;
loop
FETCH c5 INTO st,la,p;
exit when c5%notfound;
htp.p('<tr>
<td width="36"> </td>
<td width="445"> SERVICE TAX '||nvl(HTF.escape_sc (st),0)||' OF Rs.'||nvl(ROUND(HTF.escape_sc (la),2),0)||'</td>
<td> </td>
<td width="97"></td>
<td width="172">
<p align="right">'
|| nvl(ROUND(HTF.escape_sc(p),2),0)
||'</td>
</tr>');
end loop;
close c5;
htp.p('<tr>
<td width="36"> </td>
<td width="445"> </td>
<td> </td>
<td width="97"> </td>
<td width="172">
<p align="Right">------------------</td>
</tr>');
htp.p('<tr>
<td width="36"> </td>
<td width="445" align="left"> BILL AMOUNT</td>
<td> </td>
<td width="97"></td>
<td width="172" align="right">
<p >'||ROUND(HTF.escape_sc (FS),2)||'</td>
</tr>
<tr>
<td width="36"> </td>
<td width="445">
<p align="left"> '|| f_words(HTF.escape_sc (FS))||'</td>
<td> </td>
<td width="97"> </td>
<td width="172">
<p align="Right">------------------</td>
</tr>');
ELSE
FOR x IN(SELECT t.item_name, t.qty,t.rate, t.bill_no
FROM transaction_details t where t.bill_no=:p27_bill_no
LOOP
HTP.P('<tr>
<td width="2%"> </td>
<td width="55%" align="left"> '|| HTF.escape_sc (x.item_name)||'</td>
<td width="15%" ALIGN="right">'|| HTF.escape_sc (x.qty)||'</td>
<td width="15%" ALIGN="right">'|| HTF.escape_sc (x.rate)||'</td>
<td width="25%" ALIGN="right">'|| HTF.escape_sc (x.qty)* HTF.escape_sc (x.rate)||'
</td>
</tr>');
END LOOP;
tot:=0;
bc:=0;
KA:=0;
open c2;
loop
FETCH c2 INTO va,am,vat_am;
exit when c2%notfound;
tot:=nvl(tot+am,0);
bc:=nvl(bc+vat_am,0);
end loop;
close c2;
KA :=nvl(tot+bc,0);
HTP.P('<tr>
<td width="38"> </td>
<td width="29"> </td>
<td width="447"> </td>
<td> </td>
<td width="173">
<p align="Right">-------------------</td>
</tr>
<tr>
<td width="38"> </td>
<td width="447"> TOTAL</td>
<td> </td>
<td width="95"></td>
<td width="172">
<p align="right">'
|| nvl(HTF.escape_sc (tot),0)
||'</td>
</tr>');
open c4;
loop
FETCH c4 INTO va,am,vat_am;
exit when c4%notfound;
HTP.P('<tr>
<td width="38"> </td>
<td width="446"> VAT '||nvl(HTF.escape_sc (va),0)||'% OF Rs.'||nvl(HTF.escape_sc (am),0)||'</td>
<td width="116"> </td>
<td></td>
<td width="172">
<p align="right">'
|| nvl(HTF.escape_sc (vat_am),0)
||'</td>
</tr>');
end loop;
CLOSE c4;
HTP.P('<tr>
<td> </td>
<td width="30"> </td>
<td width="118"> </td>
<td width="95"> </td>
<td width="173">
<p align="Right">------------------</td>
</tr>
<tr>
<td> </td>
<td width="446" align="left"> TOTAL</td>
<td width="118"> </td>
<td width="95"></td>
<td width="173">
<p align="right">'
|| nvl(HTF.escape_sc (KA),0)
||'</td>
</tr>
<tr>
<td> </td>
<td width="446" align="left"> LABOUR CHARGES :-</td>
<td width="118"> </td>
<td width="95"></td>
<TD width="173"></td>
</tr>');
FOR Y IN(SELECT l.WORK_DETAIL,l.LABOUR_AMT
FROM LAB_WORK_DTL l where l.bill_no =:P27_BILL_NO
LOOP
HTP.P('<tr>
<td> </td>
<td width="446" align="left"> '||nvl(HTF.escape_sc (Y.WORK_DETAIL),0)||'</td>
<td width="118"> </td>
<td width="95"></td>
<td width="173">
<p align="right">'|| nvl(HTF.escape_sc(Y.LABOUR_AMT),0)||'</td>
</tr>');
END LOOP;
HTP.P('
<TR>
<td> </td>
<td width="30"> </td>
<td width="118"> </td>
<td width="95"></td>
<td width="173"> </td>
</tr>');
HTP.p ( '<tr>
<td width="36"> </td>
<td width="445"> </td>
<td> </td>
<td width="97"> </td>
<td width="172">
<p align="Right">------------------</td>
</tr>');
sa:=0;
lst:=0;
open c3;
loop
FETCH c3 INTO st,la,p;
exit when c3%notfound;
sa:=nvl(sa+la,0);
lst:=nvl(lst+p,0);
end loop;
close c3;
TH:=nvl(sa+lst,0);
FS:=KA+TH;
htp.p('<tr>
<td width="36"> </td>
<td width="445"> TOTAL</td>
<td> </td>
<td width="97"></td>
<td width="172">
<p align="right">'
||nvl(ROUND(HTF.escape_sc (sa),2),0)
||'</td>
</tr>');
open c5;
loop
FETCH c5 INTO st,la,p;
exit when c5%notfound;
htp.p('<tr>
<td width="36"> </td>
<td width="445"> SERVICE TAX '||nvl(HTF.escape_sc (st),0)||' OF Rs.'||nvl(ROUND(HTF.escape_sc (la),2),0)||'</td>
<td> </td>
<td width="97"></td>
<td width="172">
<p align="right">'
|| nvl(ROUND(HTF.escape_sc(p),2),0)
||'</td>
</tr>');
end loop;
close c5;
htp.p('<tr>
<td width="36"> </td>
<td width="445"> </td>
<td> </td>
<td width="97"> </td>
<td width="172">
<p align="Right">------------------</td>
</tr>
<tr>
<td width="36"> </td>
<td width="445" align="left"> BILL AMOUNT</td>
<td> </td>
<td width="97"></td>
<td width="172" align="right">
<p >'||ROUND(HTF.escape_sc (FS),2)||'</td>
</tr>
<tr>
<td width="36"> </td>
<td width="445">
<p align="left"> '|| f_words(HTF.escape_sc (FS))||'</td>
<td> </td>
<td width="97"> </td>
<td width="172">
<p align="Right">------------------</td>
</tr>');
END IF;
HTP.P('</table>
</body>
</html>');
END;
Similar Messages
-
hi,
i have to insert value in to two table two table transaction_details,LAB_WORK_DTL .In Item Name And item Price insert in to transaction_details and labour WORK_DETAIL,LABOUR_AMT amount insert in to ,LAB_WORK_DTL using two form .
Now I am fetching WORK_DETAIL,LABOUR_AMT from LAB_WORK_DTL in to a HTML PL/SQL report .i am using below SQL Quary to fetch data from LAB_WORK_DTL .
SELECT l.WORK_DETAIL,l.LABOUR_AMT
FROM transaction_details t,LAB_WORK_DTL l WHERE t.bill_no =l.bill_no and l.bill_no =:P27_BILL_NO
But My Result are like this.
WORK_DETAIL LABOUR_AMT
Repair Pump 334
Maitenance 232
Repair Pump 334
Maitenance 232
Repair Pump 334
Maitenance 232
Repair Pump 334
Maitenance 232
Repair Pump 334
Maitenance 232These value comes because 5 Item With Price insert into transaction_details .
i have to taking both table because i am fetching data from both table using bill no . if i am taking only one table like LAB_WORK_DTL
Quary Like
SELECTWORK_DETAIL,LABOUR_AMT FROM LAB_WORK_DTL WHERE bill_no =:P27_BILL_NO
Then that Show me
WORK_DETAIL LABOUR_AMT
Repair Pump 334
Maitenance 232Only two Record these are correct record .
But I want to display these data into an PL/SQL report.it's not neccessry,data would be insert into column WORK_DETAIL, LABOUR_AMT in to LAB_WORK_DTL .if i use SELECTWORK_DETAIL,LABOUR_AMT FROM LAB_WORK_DTL WHERE bill_no =:P27_BILL_NO Quary then It show me No Data Found Error in to PL/SQL Report .and if i use SELECT l.WORK_DETAIL,l.LABOUR_AMT
FROM transaction_details t,LAB_WORK_DTL l WHERE t.bill_no =l.bill_no and l.bill_no =:P27_BILL_NO
Then It Shows Me
WORK_DETAIL LABOUR_AMT
Repair Pump 334
Maitenance 232
Repair Pump 334
Maitenance 232
Repair Pump 334
Maitenance 232
Repair Pump 334
Maitenance 232
Repair Pump 334
Maitenance 232Then How can i fetch Correct Value From LAB_WORK_DTL using Both Table transaction_details, LAB_WORK_DTL
Thanks
Manoj
Edited by: Manoj Kaushik on Apr 13, 2010 3:27 AMhi Karthick,
Thanks To Reply Me and correct Answer
I have one more problem regarding this,
i have charge service tax on LABOUR_AMT .i am using cursor for it , Shown below
cursor c3 is select L.service_tax,SUM(L.LABOUR_AMT) LABOUR_AMT,
SUM(L.SERVICE_TAX_AMT) SERVICE_TAX_AMT
from transaction_details T FULL JOIN LAB_WORK_DTL L
ON T.BILL_NO = L.BILL_NO
WHERE T.BILL_NO = :P27_BILL_NO
GROUP BY T.bill_no,L.service_tax, T.bill_date, T.vehicle_no, T.PARTY_NAME;
Now Problem is my LABOUR_AMT is
WORK_DETAIL LABOUR_AMT
Repair Pump 334
Maitenance 232
Service tax = is fix 10.3
Service tax Should be 334 + 232 =(566*10.3)/100 = 58.29 But It's Show me In Report 2830 Rs.
and using
sa:=0;
lst:=0;
open c3;
loop
FETCH c3 INTO st,la,p;
exit when c3%notfound;
sa:=nvl(sa+la,0);
lst:=nvl(lst+p,0);
end loop;
close c3;
and there are 5 Item with price in in transaction_details corresponding bill no.
How can i get Correct Calculated Service tax which charge on labour_amtThanks -
Passing sql report query field value to hidden item in javascript
I have sql report which has in each row one html button. Let us say that query SHOULD look like (two columns, to be easy to get the point):
select 1 SECURITY_ID
, '<input type="BUTTON" value="Top10" onClick="javascript:Top10Click ('||SECURITY_ID||');" >' BTN
FROM DUAL;
function Top10Click (vValue) {
html_GetElement('P31_PROCESS_VALUE').value = vValue;
doSubmit('GO_BACK');
} <br><br>
where P31_PROCESS_VALUE is hidden item where i want to store value of row where click happened.
<br><br>
In every button i want to pass row value "SECURITY_ID" to Top10Click function for each row differently.
<br><br>
Problem is that when I place double qoute then js is not working, else js is ok but "SECURITY_ID" is passed as constant not as live SQL value.
<br><br>
Any help...THX!
<br>
Demo is on oracle:
http://htmldb.oracle.com/pls/otn/f?p=26216:1
Workspace entry:
WK: FUNKY
UN: [email protected]
PW: qwertzI have tried to unify the solution, so it looks like:
select 1 SECURITY_ID
, '<input type="BUTTON" value="Top10" onClick="javascript:Top10Click ('||'"_X;'||SECURITY_ID||'"_X;'||');" >' BTN
FROM DUAL;change '"_X;' (remove "_X" part ... so it can be seen in HTML properly!
THX Denes for great ideas... -
Refreshing sql report region based on values from another region - 4.0
Greetings All,
I have a page with two regions, say region 1 and region 2. I have a before header process that fetches values from db based on criteria entered from another page. Region 2 is a sql report region with bind variables from region 1. When this page is rendered region 1 renders properly however sql report region always returns no records. What am i missing here?
I would like to have the region 2 render a report based on the values from region 1. Region 2 has a sql query that looks something like
select
colum 1,
column 2,
column 3
from table t1
where t1.c1 = :p10_item1
and t1.c2 = :p10_item2Using apex 4.0
thanks
SeetharamanIf these items hidden, try making them display only .
Also what happens when you move the items from region 1 to region 2.
From my experience items do not have much of a dependency on the region they are attached to other than cases when the region is not rendered(when its condition fails) and then the item values become null(bcoz they themselves are not rendered). -
Pass a value from a PL/SQL function to a javascript (html header) ? ?
Hey Guys,
Have a question regarding how to pass a value from a PL/SQL function to a javascript in the HTML Header.
I have created a PL/SQL function in my database, which does looping.
The reason for this is: On my apex page when the user selects a code, it should display(or highlight buttons) the different project id's present for that particular code.
example= code 1
has project id's = 5, 6, 7
code 2
has project id's = 7,8
Thank you for your Help or Suggestions
Jesh
The PL/SQL function :
CREATE OR REPLACE FUNCTION contact_details(ACT_CODE1 IN NUMBER) RETURN VARCHAR2 IS
Project_codes varchar2(10);
CURSOR contact_cur IS
SELECT ACT_CODE,PROJECT_ID
FROM ACTASQ.ASQ_CONTACT where ACT_CODE = ACT_CODE1;
currec contact_cur%rowtype;
NAME: contact_details
PURPOSE:
REVISIONS:
Ver Date Author Description
1.0 6/25/2009 1. Created this function.
BEGIN
FOR currec in contact_cur LOOP
dbms_output.put_line(currec.PROJECT_ID || '|');
Project_codes := currec.PROJECT_ID|| '|' ||Project_codes;
END LOOP;
RETURN Project_codes;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
END contact_details;
/Jesh:
I have made the following modifications to your app to get it to work as I thing you need it to.
1) Changed the source for the HTML Buttons Region(note use of id vs name for the Buttons)
<script>
function hilitebtn(val) {
//gray buttons
$x('graduate').style.backgroundColor='gray'
$x('distance').style.backgroundColor='gray'
$x('career').style.backgroundColor='gray'
$x('photo').style.backgroundColor='gray'
//AJAX call to get project-ids
var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=GETPROJECTS',0);
get.addParam('x01',val)
gReturn = get.get();
var arr=gReturn.split(':'); //dump into array
get = null;
for (i=0;i<arr.length;i++) {
// alert('val=' + arr);
if ( arr[i]==5)
$x('graduate').style.backgroundColor='red';
if ( arr[i]==6)
$x('distance').style.backgroundColor='red';
if ( arr[i]==7)
$x('career').style.backgroundColor='red';
if ( arr[i]==8)
$x('photo').style.backgroundColor='red';
</script>
<table cellpadding='0' cellspacing='0' border='0'>
<tr><td>
<input type='button' id='graduate' value='Graduate'>
</td>
<td>
<input type='button' id='distance' value='Distance'>
</td>
<td>
<input type='button' id='career' value='Career/Tech'>
</td>
<td>
<input type='button' id='photo' value='Photos'>
</td>
</tr></table>
2) Defined the application process GETPROJECTS as DECLARE
IDS varchar2(1000);
l_act_code varchar2(100) :=4;
begin
IDS:='';
l_act_code := wwv_flow.g_x01;
for x in(
SELECT ACT_CODE,PROJECT_ID
FROM ASQ_CONTACT
where ACT_CODE = l_act_code)
LOOP
IDS := IDS || X.PROJECT_ID|| ':' ;
END LOOP;
HTP.PRN(IDS);
END;
3) Changed the 'onchange' event-handler on p1_act_code to be 'onchange=hilitebtn(this.value)'
4) Added the JS to the HTML Page Footer <script>
hilitebtn($v('P1_ACT_CODE'));
</SCRIPT> -
Passing multiple values to another page via a sql report
Having trouble passing multiple values to another page via a popup SQL report
I have two fields one called "descr" and another called "Met"
when I use the code below all works fine and the value of "descr" is passed
Select '<a href="javascript:popUp2('''
|| 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
|| 'P950_TYPE:'
|| descr
|| ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%">'
|| descr
|| '</a>' "Note"
But when I want to pass another value, all goes bonkers and instead of the value of the field being passed the literal text is passed.
can someone look at my code below and see what may be wrong
Select '<a href="javascript:popUp2('''
|| 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
|| 'P950_TYPE,P950_CODE:'
|| descr, Met
|| ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%">'
|| descr
|| '</a>' "Note"
I appeciate your help looking into this
FYI (Here is the entire SQL for reference)
With t
as
(SELECT
CASE WHEN KEY = 2 then
CASE WHEN WCS_CPT > :P940_METRIC_1_WCS_CPT1 then
'<span style="color:Red; ">'||TO_CHAR(WCS_CPT,'FML999G999G999G999G990D00')||'</span>' else
'<span style="color:#399304; ">'||TO_CHAR(WCS_CPT,'FML999G999G999G999G990D00')||'</span>' end
else '<span style="color:#180c8b;">'||TO_CHAR(WCS_CPT,'FML999G999G999G999G990D00')||'</span>' end "WCSCPT",
CASE WHEN KEY = 2 then
CASE WHEN WCS_TOI_PER_FTE < :P940_METRIC_2_WCS_TOI_PER_FTE then
'<span style="color:Red; ">'||TO_CHAR(WCS_TOI_PER_FTE,'999G999G999G999G990')||'</span>' else
'<span style="color:#399304; ">'||TO_CHAR(WCS_TOI_PER_FTE,'999G999G999G999G990')||'</span>' end
else '<span style="color:#180c8b;">'||TO_CHAR(WCS_TOI_PER_FTE,'999G999G999G999G990')||'</span>' end "WCSTOIPERFTE",
CASE WHEN KEY = 2 then
CASE WHEN WCS_SIO_PER_FTE < :P940_METRIC_3_WCS_SIO_PER_FTE then
'<span style="color:Red; ">'||TO_CHAR(WCS_SIO_PER_FTE,'999G999G999G999G990')||'</span>' else
'<span style="color:#399304; ">'||TO_CHAR(WCS_SIO_PER_FTE,'999G999G999G999G990')||'</span>' end
else '<span style="color:#180c8b;">'||TO_CHAR(WCS_SIO_PER_FTE,'999G999G999G999G990')||'</span>' end "WCSSIOPERFTE",
CASE WHEN KEY = 2 then
CASE WHEN WCS_TC_PER_FTE < :P940_METRIC_4_WCS_TC_PER_FTE then
'<span style="color:Red; ">'||TO_CHAR(WCS_TC_PER_FTE,'999G999G999G999G990')||'</span>' else
'<span style="color:#399304; ">'||TO_CHAR(WCS_TC_PER_FTE,'999G999G999G999G990')||'</span>' end
else '<span style="color:#180c8b;">'||TO_CHAR(WCS_TC_PER_FTE,'999G999G999G999G990')||'</span>' end "WCSTCPERFTE",
CASE WHEN KEY = 2 then
CASE WHEN WCS_ADSL_PER_FTE < :P940_METRIC_5_WCS_DSL_PER_FTE then
'<span style="color:Red; ">'||TO_CHAR(WCS_ADSL_PER_FTE,'999G999G999G999G990')||'</span>' else
'<span style="color:#399304; ">'||TO_CHAR(WCS_ADSL_PER_FTE,'999G999G999G999G990')||'</span>' end
else '<span style="color:#180c8b;">'||TO_CHAR(WCS_ADSL_PER_FTE,'999G999G999G999G990')||'</span>' end "WCSADSLPERFTE",
CASE WHEN KEY = 2 THEN
TO_CHAR(MONTH,'MON-YY')
else
'METRICS'
end "MONTH"
FROM (
SELECT DISTINCT
ROW_NUMBER() OVER (ORDER BY KEY DESC) AS ROW_NUM, KEY, WCS_CPT, WCS_TOI_PER_FTE, WCS_SIO_PER_FTE, WCS_TC_PER_FTE, WCS_ADSL_PER_FTE, MONTH
from TW_M_KEYMETRICS
WHERE TO_DATE(UPPER(MONTH),'DD/MON/YY') >= TO_DATE(UPPER(:P940_START_OF_THIS_FIN_YEAR),'DD/MON/YY')
ORDER BY KEY ASC, ROW_NUM, MONTH)
WHERE ROW_NUM <= :P940_MONTHS_SINCE_FIN_START)
Select '<a href="javascript:popUp2('''
|| 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
|| 'P950_METRIC_TYPE,P950_METRIC_VALUE:descr,MET'
|| ''
|| ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%">'
|| descr
|| '</a>' "Note"
, max(Met) METRICS, max(Jul) Jul08, max(Aug) Aug08, max(Sep) Sep08, max(Oct) Oct08, max(Nov) Nov08, max(Dec)Dec08, max(Jan) Jan08, max(Feb) Feb08, max(Mar) Mar08, max(Apr) Apr08, max(May) May08, max(Jun) Jun08
from (
Select 'Cost Per Transaction' descr,
decode (MONTH, 'METRICS', WCSCPT) MET,
decode (MONTH, 'JUL-08', WCSCPT) Jul,
decode (MONTH, 'AUG-08', WCSCPT) Aug,
decode (MONTH, 'SEP-08', WCSCPT) Sep,
decode (MONTH, 'OCT-08', WCSCPT) Oct,
decode (MONTH, 'NOV-08', WCSCPT) Nov,
decode (MONTH, 'DEC-08', WCSCPT) Dec,
decode (MONTH, 'JAN-08', WCSCPT) Jan,
decode (MONTH, 'FEB-08', WCSCPT) Feb,
decode (MONTH, 'MAR-08', WCSCPT) Mar,
decode (MONTH, 'APR-08', WCSCPT) Apr,
decode (MONTH, 'MAY-08', WCSCPT) May,
decode (MONTH, 'JUN-08', WCSCPT) Jun
from t
union all
Select 'Total Orders Issued Per FTE' descr,
decode (MONTH, 'METRICS', WCSTOIPERFTE) MET,
decode (MONTH, 'JUL-08', WCSTOIPERFTE) Jul,
decode (MONTH, 'AUG-08', WCSTOIPERFTE) Aug,
decode (MONTH, 'SEP-08', WCSTOIPERFTE) Sep,
decode (MONTH, 'OCT-08', WCSTOIPERFTE) Oct,
decode (MONTH, 'NOV-08', WCSTOIPERFTE) Nov,
decode (MONTH, 'DEC-08', WCSTOIPERFTE) Dec,
decode (MONTH, 'JAN-08', WCSTOIPERFTE) Jan,
decode (MONTH, 'FEB-08', WCSTOIPERFTE) Feb,
decode (MONTH, 'MAR-08', WCSTOIPERFTE) Mar,
decode (MONTH, 'APR-08', WCSTOIPERFTE) Apr,
decode (MONTH, 'MAY-08', WCSTOIPERFTE) May,
decode (MONTH, 'JUN-08', WCSTOIPERFTE) Jun
from t
union all
Select 'SIOs Per Billing FTE' descr,
decode (MONTH, 'METRICS', WCSSIOPERFTE) MET,
decode (MONTH, 'JUL-08', WCSSIOPERFTE) Jul,
decode (MONTH, 'AUG-08', WCSSIOPERFTE) Aug,
decode (MONTH, 'SEP-08', WCSSIOPERFTE) Sep,
decode (MONTH, 'OCT-08', WCSSIOPERFTE) Oct,
decode (MONTH, 'NOV-08', WCSSIOPERFTE) Nov,
decode (MONTH, 'DEC-08', WCSSIOPERFTE) Dec,
decode (MONTH, 'JAN-08', WCSSIOPERFTE) Jan,
decode (MONTH, 'FEB-08', WCSSIOPERFTE) Feb,
decode (MONTH, 'MAR-08', WCSSIOPERFTE) Mar,
decode (MONTH, 'APR-08', WCSSIOPERFTE) Apr,
decode (MONTH, 'MAY-08', WCSSIOPERFTE) May,
decode (MONTH, 'JUN-08', WCSSIOPERFTE) Jun
from t
union all
Select 'Total Calls Answered per FTE' descr,
decode (MONTH, 'METRICS', WCSTCPERFTE) MET,
decode (MONTH, 'JUL-08', WCSTCPERFTE) Jul,
decode (MONTH, 'AUG-08', WCSTCPERFTE) Aug,
decode (MONTH, 'SEP-08', WCSTCPERFTE) Sep,
decode (MONTH, 'OCT-08', WCSTCPERFTE) Oct,
decode (MONTH, 'NOV-08', WCSTCPERFTE) Nov,
decode (MONTH, 'DEC-08', WCSTCPERFTE) Dec,
decode (MONTH, 'JAN-08', WCSTCPERFTE) Jan,
decode (MONTH, 'FEB-08', WCSTCPERFTE) Feb,
decode (MONTH, 'MAR-08', WCSTCPERFTE) Mar,
decode (MONTH, 'APR-08', WCSTCPERFTE) Apr,
decode (MONTH, 'MAY-08', WCSTCPERFTE) May,
decode (MONTH, 'JUN-08', WCSTCPERFTE) Jun
from t
union all
Select 'ADSL Orders per FTE' descr,
decode (MONTH, 'METRICS', WCSADSLPERFTE) MET,
decode (MONTH, 'JUL-08', WCSADSLPERFTE) Jul,
decode (MONTH, 'AUG-08', WCSADSLPERFTE) Aug,
decode (MONTH, 'SEP-08', WCSADSLPERFTE) Sep,
decode (MONTH, 'OCT-08', WCSADSLPERFTE) Oct,
decode (MONTH, 'NOV-08', WCSADSLPERFTE) Nov,
decode (MONTH, 'DEC-08', WCSADSLPERFTE) Dec,
decode (MONTH, 'JAN-08', WCSADSLPERFTE) Jan,
decode (MONTH, 'FEB-08', WCSADSLPERFTE) Feb,
decode (MONTH, 'MAR-08', WCSADSLPERFTE) Mar,
decode (MONTH, 'APR-08', WCSADSLPERFTE) Apr,
decode (MONTH, 'MAY-08', WCSADSLPERFTE) May,
decode (MONTH, 'JUN-08', WCSADSLPERFTE) Jun
from t
GROUP by descr
FrankBorg Species 5618 wrote:
Having trouble passing multiple values to another page via a popup SQL report
But when I want to pass another value, all goes bonkers and instead of the value of the field being passed the literal text is passed.
can someone look at my code below and see what may be wrong
Select '<a href="javascript:popUp2('''
|| 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
|| 'P950_TYPE,P950_CODE:'
|| descr, Met
|| ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%">'
|| descr
|| '</a>' "Note"
Hi Frank,
You should close this parameters with single quotation. Try this -
Select '<a href="javascript:popUp2('''
|| 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
|| 'P950_TYPE,P950_CODE:'
*|| 'descr, Met'*
|| ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%">'
|| descr
|| '</a>' "Note"
Hope this helps.
Regards,
M Tajuddin
http://tajuddin.whitepagesbd.com -
Please Help - SQL Report long column value required in a separate cell
Hi.
I need to create a SQL report with the structure like below:
Country State City Vertical Business Details (detail desc)
US MA Quincy Healthcare
This is a detail desc value that needs to displayed in a different cell.
This is a detail desc value that needs to displayed in a different cell.
This is a detail desc value that needs to displayed in a different cell.
This is a detail desc value that needs to displayed in a different cell.
US MA Braintree IT
This is a detail desc value that needs to displayed in a different cell.
This is a detail desc value that needs to displayed in a different cell.
This is a detail desc value that needs to displayed in a different cell.
I came through a solution where you can hide/display the long column value in a different cell. But my requirement is that it should be displayed when the page opens and user don;t want to click on a button to see the value. This is mainly for their presentations and printing. so its very annoying for them to click on so many buttons to see the detail desc value for every record. I am new to Java script, Please helpI'm not sure I understand your requirements--are you showing us 2 lines of data, 7 lines, or 9? Do you want the long detail description on the same row, or underneath it?
I'm going to go on the assumption that you're showing us two rows, and that the long descriptions in this example happen to be 3-4 lines long, and that you want the long descriptions underneath the details. In which case, I suggest using "named column" templates. They're a lot easier to use than they appear when you first look at them, so bear with me.
Under "Shared Components", select "Templates", and then click on the yellow Create> button. You're creating a report template, from scratch. On the final page of the wizard, select "Named Column (row template)" for the template type. This will create a rather generic (and useless) template, which you'll have to edit; I don't know why they chose to not send you straight into the editor. When you edit it, you'll see that the only field with a value in it is "Row Template 1", and it's set to:
<tr><td>#1#</td><td>#2#</td><td>#3#</td><td>#4#</td><td>#5#</td></tr>For meeting your requirements with basic functionality, change it to something along the lines of:
<tr><td>#COUNTRY#</td><td>#STATE#</td><td>#CITY#</td><td>#VERT#</td></tr>
<tr><td colspan="4">#DETAILS#</td></tr>Then you'll probably want to put something under Column Heading Template, like:
<tr><td>Country</td><td>State</td><td>City</td><td>Vertical Business</td></tr>
<tr><td colspan="4">Details</td></tr>Apply whatever CSS styles you want to it, of course.
Using the template is straightforward: if your report, chose the template, and make sure your SQL returns values using the column names you specified in your template. Otherwise, you'll see literal "#COUNTRY#" text in your report.
You can get fancy with these, of course, such as applying different styles to alternating rows, but I'll leave this as good enough to get you started (I hope).
-David -
Pass Page 0 TextBox item value to populate SQL Report on another page.
Hi,
I have created one textbox and one Template Based Button on page 0.
And i have coded (On Button Display Attributes)
I want to pass Page 0 TextBox value into the SQL Report on Page100.
For this i planed to pass the value entered on Page 0 (TextBox) by coping the entered value into clipboard and assign this value to a hidden textbox(P100_SEARCH), which is on page 100. so that i can pass this value to the SQL Report.
I have coded (On Button Display Attributes) in Page 0.
onclick="javascript:window.clipboardData.setData('Text', document.getElementById('P0_SEARCH').value);redirect('f?p=229:100:&APP_SESSION.::NO:::');"
So its copying the entered value into clipboard and redirecting to page 100.
But here i am facing the problem
how to assign the save clipboard value into Hidden TextBox(P100_SEARCH) on page 100, so that data is
populated on page100 according to the enterd value from page 0.
Please help me . Its urgent.
Thanks
--PMHi,
I think it is the button templates that are causing the problem as they a normally designed to submit the page and you need to do a redirect.
I would suggest doing the following:
1 - Go to Shared Components, Templates
2 - Click Create
3 - Select Button
4 - Select "As a Copy of an Existing Template"
5 - Click Next until you get to a list of existing button templates
6 - Change the name of the "Copy of ..." for the template that you are using (to something like "Button for javascript") and select Yes in Copy?
7 - Click Copy Button Template
8 - When it has been created, you are returned to the templates list - click the edit link for your new button
9 - Update the "Template" setting. How you change this depends on your Theme and the Button Template you are using. But, as an example, in Theme 19 and using the Button button template, change:
<input onclick="#LINK#" class="t19Button" value="#LABEL#" type="button" />to:
<input #BUTTON_ATTRIBUTES# class="t19Button" value="#LABEL#" type="button" />So, the onclick="#LINK#" setting is removed and the #BUTTON_ATTRIBUTES# one is added in instead.
Now, go back to Page 0 and change your button to use this new template.
Change the Button Attributes setting to:
href="javascript:void(0);" onclick="javascript:redirect('f?p=&APP_ID.:100:&SESSION.::NO::P100_SEARCH:' + $v('P0_SEARCH'));"and Apply Changes
Now try your page again
Andy -
SQL report link to another report
Hello,
I am using Apex 4 and trying to link an sql report with another report. If I were able to use an interactive report I could easily link that to another page, but that would require me to have a primary key. The problem is that I need to link a few tables. So two questions:
1.) Can I link these via an HTML link to my other page? I would have a HTML link in my report that would link via URL parameter passing. So can I use HTML in a report?
2.) What is the syntax for a parameter passing via URL? Here is my link that would be:
a href= f?p=107:40:&APP_SESSION::::P40_NAME:MARK: Are there any other ways to accomplish this?
Thanks,
Mark
Edited by: LondonMark on 23-May-2011 04:18
Edited by: LondonMark on 23-May-2011 04:20I am using Apex 4 and trying to link an sql report with another report. If I were able to use an interactive report I could easily link that to another page
It's easy in standard reports< /a>. (Ignore the "Interactive Report" typo in step 1.)
1.) Can I link these via an HTML link to my other page? I would have a HTML link in my report that would link via URL parameter passing. So can I use HTML in a report?You can, but it's better practice to keep data retrieval and HTML structure separate when possible—in this case by using declarative Column Links.
2.) What is the syntax for a parameter passing via URL?This is also covered in the documentation.
Here is my link that would be: a href= f?p=107:40:&APP_SESSION::::P40_NAME:MARK:
{quote}
That looks to have the order of the parameters correct, but it's missing some syntax:<a href="f?p=107:40:&APP_SESSION.::::P40_NAME:MARK">...</a>
The static text exact substitution method of referencing the value of an APEX item requires a terminating dot ("."): <tt>&APP_SESSION.</tt> -
Items is a region displayed after a sql report region!
Hello everybody!
I have 3 regions :
1/ HTML text region with some items : sequence 10, column1
2/ SQL report region : sequence 20, column1
3/ HTML text region with some items : sequence 30, column1
I have many problems and errors when submitting the page and saving data into tables, I think that htmldb is not getting the correct values corresponding to the correct items.
If I change the column diplay of the sql report region to "2", or if I change the sequence of the SQL report region to 40, all is ok!!!
(I am using wwv_flow.g_f10(i) to retreive data from the report).
Any idea ?Hello Raju,
Ok, My example is more complexe, but I have succed to reproduce the error in a sample example in my oracle htmldb workspace,
My access info have bee sect to : [email protected]
You will find the example in application 21275_TEST page 2.
I have 3 regions, the second is a report sql region in witch I have a popkeyfrom query item.
My submit button, update a table with a text field (item P2_IT, region1) and a date(item P2_MONTH ,region3).
You will see that when submitting, you will get an error : not a valid month....
I have not understand what is being done at save, but I am sure that the value of P2_MONTH is not correctly setted when updating the table!
Just, changing the sequence of the report region from 10 to 30 resolve the problem,
but I must have this region between the two others!!!
Thanks for the help! -
Controlling the page of an SQL report region
I have an SQL report region containing 70 rows. It shows the status of a bidding process that takes place in sequence, from the guy in the first row to the guy in the last. I use a "red light/green light" technique in each row to show who is currently eligible.
Typically users will login and then hit the next button to get to where the action is once the first 15 folks are done (number of rows = 15). Is there some way to set which set of rows first appears?
I looked at the URLs. When I first logged in I got:
http://htmldb.ciscoinc.com/bill/f?p=173:3:15341208186623218430::NO:::
After clicking "Next" I got:
http://htmldb.ciscoinc.com/bill/f?p=173:3:15341208186623218430:pg_R_4821423314714801953:NO&pg_min_row=16&pg_max_rows=15&pg_rows_fetched=15
How do I come up with:
pg_R_4821423314714801953 ?
Any thoughts? Thanks.
BillBill,
I would suggest using a dynamic query thatâs referencing a page item to limit the result set so that the correct records are shown when the user branches to the report page. Manually modifying the pagination URL is not supported. The URL contains the internal region ID, and is setting some internal pagination variables. The internal workings of report pagination could change in future versions of HTML DB, so manually manipulating those values could cause your report to break duing a future upgrade.
Regards,
Marc -
How can i pass parameter values from html to a shell script
Hi Guys...
I had a requirement where i need to execute a sql statement and print the output in HTML page. This report has parameters to enter. So i created a HTML form which accepts parameters. When the submit button is pressed, the action tag in the form invokes unix shell script file. It will open sqlplus and run the sql script file .sql and print the output in the HTML page.
sql script contains the query and some set options which prints the output in HTML page. Like "SET MARKUP HTML ON"... The query has some parameters like "select * from emp where empno = &&empnumber. I will use the same name "empnumber" while created the HTML parameter form like " <input type = "text" name="empnumber" size="10" align="left">.
user sees this parameter form and enters some value in to that empno text box.
My question is how can i catch these parameter values in a shell script and pass it to the sql script to execute it.
Help Appreciated
ThanxThis is a A Bad Idea (tm). This type of CGI processing is old and were (and still is) full of security holes. Very easy to inject stuff (Unix commands and SQL) into it.. To get those parameters into SQL*Plus requires using Unix shell commands to process it - and something like a backquote allows all kinds of nasty stuff to be injected. The Unix shell was never designed to be used as a secure CGI environment.
There are far better and far superior alternatives. Perl (with Perl_DBI) and PHP (using Zend Core for Oracle) come to mind as web scripting languages.
Even easier is using HTMLDB. Very few moving parts. Is free. Supports Oracle 9.2 and 10G. -
Is there any way to hook into the SQL report pagination process?
I have a SQL report (based on EMP) with a radiogroup row selector.
The scenario 1 and 2 are in place
1) When the employee row radio group is clicked the P900007_JOB the text item is populated with the JOB for the employee.
2) When the page is initially displayed or submitted via the button the first row’s radio group is programmatically clicked and therefore populates the additional job information in P900007_JOB
Info (radio Group) Employee No Name
(+) 7369 SMITH
() 7499 ALLEN
() 7521 WARD
P900007_JOB CLERK
1-3 Next>
Once the report has been displayed and the next or previous pagination is used then none of the radio groups will be selected and the data in the P900007_JOB text item will still display the job of the last selected employee row.
What I require is on pagination some sort of mechanism to either
a) Call the page_init() that should then set the first row as selected and populate the text item via the programmatic click. (preferred option)
b) OR blank out the additional text item P900007_JOB.
Is there any way to hook into the pagination process?
I have a work around – Set the ‘Enable Partial Page Refresh’ to ‘No’ but this means a full refresh every time the pagination is used.
Details of my page
Report Region (Based on EMP table) – radio group as a row selector
select APEX_ITEM.RADIOGROUP(1,EMPNO,'X21',null) CHECKRG, EMPNO,
ENAME,
JOB
from EMP
Report Attributes -
Report template :- P900007_ROWTEMPLATE (custom template see later)
Report Attributes Substitution :- id="emp_report" (used in page_init see later)
Enable Partial Page Refresh :- Yes
Columns – All columns are selected as show but job is left out of the template below.
P900007_JOB - Text item in report region (disabled does not save state). Populated with the employees job when the radio group is clicked.
Control region :- HTML region that just holds a button <GO> just to submit the page and redirect back to the same page.
P900007_ROWTEMPLATE (named column row template)
Row template 1
<tr style="cursor: hand; cursor: pointer;" onmouseover="row_mouse_over(this, 1)" onmouseout="row_mouse_out(this, 1)" #HIGHLIGHT_ROW# ">
<td class="t15data" onclick="selectRow('#JOB#');">#CHECKRG# </td>
<td class="t15data">#EMPNO# </td>
<td class="t15data">#ENAME# </td>
</tr>
Before rows
<table class="t15standard" summary="" #REPORT_ATTRIBUTES# id="report_#REGION_STATIC_ID#" >
<th class="t15header" #ALIGNMENT# >Info</th>
<th class="t15header" #ALIGNMENT# >Employee Number</th>
<th class="t15header" #ALIGNMENT# >Name</th>
After Rows
<tr>
<td colspan="99" class="t15afterrows">
<span class="left">#EXTERNAL_LINK##CSV_LINK#</span>
<table style="float:right;text-align:right;" summary="pagination">
#PAGINATION#</table>
</td>
</tr>
</table>
*Javascript in page Header*
<script src="#WORKSPACE_IMAGES#apex_show_hide_region.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">
<!--
function selectRow(pJob)
/* console.log('pete got here!'+pJob)*/
$x('P900007_JOB').value =pJob;
/* Start Page init*/
function *page_init*()
/* Used to set radio groups on reports */
/*console.log('START pete got here!');*/
var is_checked = false;
var l_check = $x_FormItems($x('emp_report'), 'radio');
/*Loop and set flag if checked*/
for(var i=0,len=l_check.length;i<len;i++)
if(l_check.checked){
is_checked = true;
/*end loop*/
/*If none checked force a click*/
if(!is_checked){
/*no longer need as doing click below*/
l_check[0].checked=true;
/*Force a click on the first radio group - extra details should then be
populated*/
var l_click = l_check[0].click();
/* console.log('END pete got here!');*/
/*END page_init*/
// -->
</script>
*Application shared component.* – This fires a DB packaged procedure when the page is loaded.
P330_PART_NO_HIST
Process Point On load after Body region
Process Text show_hide_memory.part_no_history_details();
*Packaged Procedure* – This kicks off the page_init javascript in the header (earlier) to click on the radio group in the first row.
PROCEDURE part_no_history_details AS
BEGIN
htp.prn('<script type="text/javascript">' || CHR(10));
htp.prn('<!--' || CHR(10));
htp.prn('page_init();'|| CHR(10));
htp.prn('//-->' || CHR(10));
htp.prn('</script>' || CHR(10));
END part_no_history_details;
Thanks Pete
Edited by: Pete @ LSC on 26-Jan-2010 06:56Anybody any ideas? Should I be looking down the route of using my own pagination buttons and adding my code to this?
There seems to be a routine $a_report that I can use for the pagination but I am finding it difficult to get the current first and last record values that I would need to pass. I've seen references to below in the form but when I'm using partial refresh they do not seem to change.
wwv_flow.g_flow_current_min_row
wwv_flow.g_flow_current_max_rows
wwv_flow.g_flow_current_rows_fetched
wwv_flow.g_request
Thanks Pete -
Refresh SQL Report (Submit Page Item)
I want to add a search field in a SQL Report. I have something like this
SELECT * FROM emp
WHERE emp_no LIKE :P1_SEARCH || '%'I want to do the search asynchronous, on keypress. The problem is that a SQL Report doesn't have a "Submit Items:" atribute like a interactive report.
So after i refresh the report:
$a_report($x('P1_REPORT_ID').value,'1','10','100');The report is refreshing (the circle icon on top of the screen) but nothing changes cause the :P1_SEARCH doesn't submits.
How could i submit a page item from JS ?
King Regards,
Cearnau Dan
PS: I'm using APEX 4 and using dynamic actions it's the same like the Javascript call.(still doesn't submits the :P1_SEARCH item)Hi Dan,
I would suggest not to use the undocumented
$a_report($x('P1_REPORT_ID').value,'1','10','100');It's very likely that it will be changed in APEX 4.1
Dan.Cearnau wrote:
PS: I'm using APEX 4 and using dynamic actions it's the same like the Javascript call.(still doesn't submits the :P1_SEARCH item)That's true, but have a look at Anthony's blog posting http://anthonyrayner.blogspot.com/2010/07/report-filtering-with-apex-40-dynamic.html which explains a workaround to pass the new values for a classic report as well.
Regards
Patrick
My Blog: http://www.inside-oracle-apex.com
APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf -
SQL Report with 1 updatable column - help urgent
Hi,
I have a SQL report. I am using collection to store value of selected record by link column.
I have a updatable text item (NULL) in the column. I am able to store that value in the collection.
Any clue?
Code
1. Creating a collection in parent page:
apex_collection.create_or_truncate_collection
(p_collection_name => 'ORDER');
2. Query to populate item rows with option to key 'QTY' before pressing 'Add to Order' link.
select
itemcode,
description,
NULL AS qty,
'Add to Order' add_to_order
from itemtab
3. Made 'QTY' to Text item -- to allow users to key value
4. Created 'hidden & protected' items P1_ITEMCODE, P1_QTY
5. Set values of itemcode, qty in add_to_order link
6. Created a process to add values into collection:
for x in (select * from itemtab where itemcode = :P1_ITEMCODE)
loop
apex_collection.add_member(p_collection_name => 'ORDER',
p_c001 => x.ITEMCODE,
p_c002 => x.DESCRIPTION,
p_c003 => :P1_QTY
end loop;
7. Display value of itemcode, description, qty in report region
select c001, c002, c003
from apex_collections
where collection_name = 'ORDER'
Probem: The value of qty is not being stored in the collection and not appearing in the #7 report. itemcode and description values are fine.
Thanks,
DipDip,
I'm guessing here as I can't see your application, I think your missing the page process to collect the data from your QTY field.
I created a quick demo of what i think your trying to achieve on apex.oracle.com
http://apex.oracle.com/pls/apex/f?p=19923:2
I added this to the html expression on the report Field add to:
<input type="button" onclick="doSubmit(#RANDOM_ID#)" value="Add To" />
Then the page process to collect and set the page item:
DECLARE
l_qty number;
BEGIN
FOR i in 1..APEX_APPLICATION.G_F03.COUNT LOOP
l_qty := nvl(APEX_APPLICATION.G_F03(i),0);
IF l_qty > 0
THEN
:P2_QTY := l_qty;
:P2_RANDOM_ID := :REQUEST;
EXIT;
END IF;
END LOOP;
END;
Let me know if this helps
Mark
Don't forget to mark reply as helpful or correct as this may help others reading this thread in the future!
Edited by: cptbutcher on Mar 25, 2010 10:40 PM
Maybe you are looking for
-
Macbook Air thunderbolt ethernet not working after 10.8.3 update
Hi, Thunderbolt Ethernet for my Macbook Air (11-inch, Mid 2012) stopped working after installing 10.8.3 update. I am unable to conect to my router via thunderbolt Ethernet connection port. Anyone else having the same issue? Any recommendations?
-
Hello - My iMac has developed a video display problem. Everything now appears in a strange, cartoonish way. Purples, greens, blues. Can this be fixed, and if so, any idea how much it might cost? Also, could I output to a seperate monitor? I plan to r
-
Have 2 IPods Want Transfer from First Gen to MacBook Pro but using 4th Gen
Have old 1st gen Ipod with music on it. I have a 4th Gen Ipod that I use with MacBook Pro. Wont let me transfer music from 1st gen to new computer. Old computer sold to buy new one. Any ideas??
-
I have tried everything to find info on why it does not appear. There isn't any that I can find.
-
Moving picture dont import...
Hi, I use a Cannon Digital Ixuss 55 and when I take some movie shots with the camera it captures them fine but when I try to import them , iPhoto tells me there is nothing to import . I would love it if there is something simple to sort this out .or