Home » Developer & Programmer » Forms » go_item..
go_item.. [message #83437] Tue, 07 October 2003 23:58 Go to next message
Mubeen.
Messages: 37
Registered: May 2003
Member
Hi All,

go_item is not working in when-validate_item trigger,is there any alternate solution for this.
An example will be of much help..

Thanx in advance..

Regards
Mubeen.
Re: go_item.. [message #83438 is a reply to message #83437] Wed, 08 October 2003 00:08 Go to previous messageGo to next message
Venky
Messages: 52
Registered: October 2001
Member
when-validate-item trigger validates and automatically triggers navigation, so you can't use the restricted built-ins like go_item,next_item etc. But you can do work around using timers. Again it is not wise to use timers when you deploy forms in web. It is very expensive. So better don't use go_item inside a when-validate-item trigger. I really wonder why you need go_item inside that trigger.
Re: go_item.. [message #83439 is a reply to message #83438] Wed, 08 October 2003 00:16 Go to previous messageGo to next message
Mubeen
Messages: 44
Registered: February 2003
Member
Hi venky,

Thanx for your prompt reply and suggestion.
what i am trying to do in my application is

Say for example,I have one field customer code and customer name,i am calling a procedure in two triggers in customer code field,they are when-validate-item and key-next-item,the procedure is working in key-next-item but not in when-validate-item.

Please find below the procedure i have written:-

PROCEDURE pu_valid_code(code1 varchar2) IS
vn_Str_Len number;
vn_Curr_Char char;
vv_desc_cd varchar2(20);
x number;
code varchar2(50);

BEGIN
if :action = 'C' or :Action is Null then
Null;
else
code:=code1;
-- Check for code not empty in all modes
if :action in ('A','M','D','V','S') or :global.prev_action in ('A','M','D','V') then
if code is null or code = ' ' then
pk_alert.p_message('Customer Code Should Not Be Empty');
raise Form_Trigger_Failure;
go_item('bk_tcst.cust_cd');

end if;
end if;

-- Check in Add mode
if :action in('A') or ltrim(rtrim(:global.prev_action)) in ('A') then
-- Check for valid characters in code for add mode

vn_Str_Len := Length(code);
For I in 1..vn_Str_Len
Loop
vn_Curr_Char := substr(code,I,1);
if (ascii(vn_Curr_Char) between ascii('A') and Ascii('Z'))
or (ascii(vn_Curr_Char) between ascii('0') and Ascii('9')) then
vv_desc_cd := vv_desc_cd||vn_Curr_Char;
else
pk_alert.p_message('Valid Characters are (A-Z) and (0-9)');
--go_item('fsl_Area.Area_Cd');
go_item('BK_TCST.CUST_CD');
Raise Form_Trigger_failure;
end if;
End Loop;

-- Check for duplicate code in Add mode
--select count(*) into x from fsl_Area where Area_Cd = :fsl_Area.Area_Cd;
select count(*) into x from CUSTOMER where CUST_CD = :BK_TCST.CUST_CD;
if x>0 then
Pk_Alert.P_Message('Customer Code Already Exists');
--:fsl_Area.Area_Cd:=null;
:BK_TCST.CUST_CD := NULL;
--go_item('fsl_Area.Area_Cd');
go_item('BK_TCST.CUST_CD');
Raise Form_Trigger_Failure;
end if;
end if;

-- Check if code exists in Modify,Delete,View mode
if :action in('M','V','D') or :global.prev_action in ('M','V','D') then
/*select count(*) into x from fsl_Area
where Area_cd = :fsl_Area.Area_Cd;*/
SELECT COUNT(*) into x
FROM CUSTOMER
WHERE CUST_CD = :BK_TCST.CUST_CD;

if x=0 then
Pk_Alert.P_Message('Invalid Customer Code');
--:fsl_Area.Area_Cd := Null;
:BK_TCST.CUST_CD := NULL;
Raise Form_Trigger_Failure;
else
p_disable('BK_TCST.CUST_CD','ITEM');
p_disable('BK_TCST.CUST_CD_lov_butt','ITEM');
end if;
end if;
End if;
End;

i need to call this procedure in when-validate-trigger but only go_item is not working,rest everything is ok ..

Regards
Mubeen.
Re: go_item.. [message #83488 is a reply to message #83437] Thu, 16 October 2003 09:15 Go to previous message
sameer_am2002
Messages: 129
Registered: September 2002
Senior Member
The thing is if you are writing when-validate-item on item level on customer code. then since its already there on that time then y u need to write go_item in the plsql block. If u remove that go_item i hope still it will work.
Previous Topic: can anyone answer these que
Next Topic: commit form problem
Goto Forum:
  


Current Time: Fri Apr 19 09:19:39 CDT 2024