Home » Developer & Programmer » Forms » when- validate-item codes
when- validate-item codes [message #419532] Mon, 24 August 2009 00:52 Go to next message
lancee
Messages: 11
Registered: August 2009
Location: Philippines
Junior Member

I have tried this code and I eas able to get a prompt when the user inputs. But the problems I face are:
1.)How will I transform this code so that it will not loop and will only prompt once and
2.)How to put if-else in the code so that
I can display the right message for ST or NST respectively...
My code:
_______________________________________
if :system.record_status='QUERY' then
null;
else
begin
for c1 in (select cpl_dtl from coil_history)
loop
--:coil_history.input_coil_no:=c1.coil_no;

alert_pkg.msg('The user inputs ST which means the coil undergone side trimming?');

end loop c1;
end;
end if;
___________________________
how it works:
the user inputs ST/NST
IF CPL_DTL='ST'
Window will prompt:The windows has ok and cancel button.
The user inputs ST which means the coil undergone side trimming?
Else if CPL_DTL='NST'
Window will prompt:The windows has ok and cancel button.
The user inputs ST which means the coil undergone no side trimming?
I will be very thankful for any help you could give.
Thanks
Re: when- validate-item codes [message #419628 is a reply to message #419532] Mon, 24 August 2009 09:29 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
I'm confused as to what it is you're trying to achieve here.
If you want a WVI trigger to check the users input then why are you:
1) checking the record_status?
2) coding a cursor for loop?

Re: when- validate-item codes [message #419657 is a reply to message #419628] Mon, 24 August 2009 19:33 Go to previous messageGo to next message
lancee
Messages: 11
Registered: August 2009
Location: Philippines
Junior Member

1) checking the record_status?

Actually, I just copied the code for checking the record_status in the key-next-item code I have because I thought they are the same.But my main concern is how to display the window or prompt message for ST/NST when the user inputs either of the two.

2) coding a cursor for loop?
I had also seen this code and I just combine them. I want to prompt the message window only once after it attempts to leave the item, but I don't know how to do it.

Thanks for the clarification.
Re: when- validate-item codes [message #419718 is a reply to message #419532] Tue, 25 August 2009 05:35 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
You definitely don't need the check on record status.
I doubt you need a loop either - in fact I'm not sure why you're querying the database at all since you appear to want to check if the datablock item is a particular value.
As for the pop-up window just use an alert.
Re: when- validate-item codes [message #419880 is a reply to message #419532] Tue, 25 August 2009 21:22 Go to previous messageGo to next message
lancee
Messages: 11
Registered: August 2009
Location: Philippines
Junior Member

Hello! I had tried this code below and I was able to get a prompt
but unfortunately it only display the else portion message- 'The user inputs ST ?' even though I selected the other option which is 'No side trimming'
and even though I selected none of the option still I get the same results. I used a drop-down list for the options.
_______________________________
begin

IF :COIL_HISTORY.CPL_DTL=' NO SIDE TRIMMING' THEN

Alert_pkg.msg('The user inputs NST?');

ELSE


Alert_pkg.msg('The user inputs ST ?');

END IF;
EXCEPTION WHEN NO_DATA_FOUND THEN
ALERT_PKG.MSG('NO DATA');
end;
_________________________________
Can someone help me to debug this..
Thanks!


Re: when- validate-item codes [message #419959 is a reply to message #419532] Wed, 26 August 2009 05:19 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
List items have two values for each item in the list. The one that's displayed and the one that's stored.

I presume you're tring to check the value that's displayed when you should be checking the value that's stored.

Also lose the exception handler - that code will never raise no_data_found.
Re: when- validate-item codes [message #420257 is a reply to message #419532] Thu, 27 August 2009 21:38 Go to previous messageGo to next message
lancee
Messages: 11
Registered: August 2009
Location: Philippines
Junior Member

I tried this code and it compiled successfully but when I input either ST and NST, it has no effect. I mean, there's no window prompting after I input ST or NST.
DECLARE
v_1 varchar2(200);

BEGIN
SELECT cpl_dtl into v_1 from coil_history;
if v_1='ST' then
Alert_pkg.msg('Is this really undergone ST?');
elsif v_1='NST' then
Alert_pkg.msg('Is this really undergone NST?');
end if;

EXCEPTION
WHEN NO_DATA_FOUND THEN
message('No Value Found');

END;


Thanks for anyone who could help me debug this.
Re: when- validate-item codes [message #420309 is a reply to message #419532] Fri, 28 August 2009 04:41 Go to previous message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Use a message to display the value of v_1.
Previous Topic: How to create a search screen and display results
Next Topic: what is free form text ?
Goto Forum:
  


Current Time: Fri Sep 20 06:29:49 CDT 2024