Home » Developer & Programmer » Forms » when validate-item
when validate-item [message #419526] Sun, 23 August 2009 23:38 Go to next message
lancee
Messages: 11
Registered: August 2009
Location: Philippines
Junior Member

Hello!
I'm a novice to pl/sql.
can someone help me how to code this:

The user will input either ST/NST, after inputting one of the following, if it will attemp to leave at that item a window will prompt and ask:
If user inputs 'ST':
Is this really undergone ST?
where the window has yes, no and cancel button to choose from.
Is this really undergone NST?
where the window has yes, no and cancel button to choose from.

Given the item is Null, it will prompt
Please input either ST/NST.
____________________________________________________________
My code:
declare
begin
select cpl_dtl from coil_history
if cpl_dtl='st'
then
message('Is this really undergone ST?')
else
message('Is this really undergone NST?')
EXCEPTION
WHEN OTHERS THEN MESSAGE ('Please enter either st/nst')
end;
_____________________________________________________________
Hoping someone can help me.

Thanks!

[Updated on: Sun, 23 August 2009 23:46]

Report message to a moderator

Re: when validate-item [message #419527 is a reply to message #419526] Sun, 23 August 2009 23:54 Go to previous messageGo to next message
BlackSwan
Messages: 24912
Registered: January 2009
Senior Member
Good Luck!

[Updated on: Sun, 23 August 2009 23:55]

Report message to a moderator

Re: when validate-item [message #419767 is a reply to message #419527] Tue, 25 August 2009 09:22 Go to previous messageGo to next message
TonyJaa
Messages: 50
Registered: May 2009
Member
Hello,

Use ALERT instead of message. It will return the key pressed (cancel, Yes, No)

select statement is not OK.

Try to find a tutorial.
Re: when validate-item [message #419935 is a reply to message #419526] Wed, 26 August 2009 04:27 Go to previous messageGo to next message
sharjeelshafqat
Messages: 33
Registered: August 2009
Location: Pakistan
Member

declare
v_1 varchar2(200);
begin
select cpl_dtl into v_1 from coil_history
if v_1='st' then
message('Is this really undergone ST?')
elsif v_1='nst' then
message('Is this really undergone NST?')
end if;
EXCEPTION
WHEN NO_DATA_FOUND THEN
message('No Value Found');
WHEN TOO_MANY_ROWS THEN
null;
WHEN OTHERS THEN
null;
end;



_______________________________
Thanks
Sr. Oracle Programmer
Sharjeel
Re: when validate-item [message #419964 is a reply to message #419935] Wed, 26 August 2009 05:27 Go to previous messageGo to next message
cookiemonster
Messages: 12320
Registered: September 2008
Location: Rainy Manchester
Senior Member
sharjeelshafqat wrote on Wed, 26 August 2009 10:27
declare
v_1 varchar2(200);
begin
select cpl_dtl into v_1 from coil_history
if v_1='st' then
message('Is this really undergone ST?')
elsif v_1='nst' then
message('Is this really undergone NST?')
end if;
EXCEPTION
WHEN NO_DATA_FOUND THEN
message('No Value Found');
WHEN TOO_MANY_ROWS THEN
null;
WHEN OTHERS THEN
null;
end;



_______________________________
Thanks
Sr. Oracle Programmer
Sharjeel


If you're going to post solutions to problems it would help if you:
a) read the forum guide - especially the bit about formating your posts.
b) paid attention to the requirements - as TonyJaa already pointed out the OP needs to use alerts not messages.

Also - don't use exception when others then null! It's a really bad coding practice.

Anyway this issue is being dealt with in the OPs other thread.
Re: when validate-item [message #420255 is a reply to message #419526] Thu, 27 August 2009 20:17 Go to previous messageGo to next message
lancee
Messages: 11
Registered: August 2009
Location: Philippines
Junior Member

I have tried the solution being posted and change the message to alert_pkg.msg. It compiled successfully after I put a ';' at the of select statement, but there is no effect when I enter 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');
--WHEN TOO_MANY_ROWS THEN
--null;
WHEN OTHERS THEN 
null;

END;


Even though, the program does not work, I 'm very thankful for the code, cause somehow I understand the code but could not pinpoint what seems to be wrong. It does not prompt any message at all.

[Updated on: Thu, 27 August 2009 21:32]

Report message to a moderator

Re: when validate-item [message #420258 is a reply to message #420255] Thu, 27 August 2009 22:17 Go to previous messageGo to next message
sharjeelshafqat
Messages: 33
Registered: August 2009
Location: Pakistan
Member

Write this exact code. Dont change it then check messages displayed or not?
_________________________________

DECLARE

v_1 varchar2(200);

BEGIN

SELECT cpl_dtl into v_1 from coil_history;

if v_1='ST' then
message('Is this really undergone ST?');

elsif v_1='NST' then
message('Is this really undergone NST?');

end if;

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

END;



___________
Thanks
Sharjeel
Oracle Programmer
Re: when validate-item [message #420261 is a reply to message #419526] Thu, 27 August 2009 22:54 Go to previous messageGo to next message
lancee
Messages: 11
Registered: August 2009
Location: Philippines
Junior Member

I tried the code and compiled successfully.
But, there are no check messages after I enter ST/NST.
It just go to the next item after I click enter key.
Re: when validate-item [message #420263 is a reply to message #420261] Thu, 27 August 2009 23:05 Go to previous messageGo to next message
sharjeelshafqat
Messages: 33
Registered: August 2009
Location: Pakistan
Member

Try this code with POST_TEXT_ITEM trigger

When Validate Item Riase when you go for new record
or save record.


__________________
Thanks
Sharjeel
Oracle Developer
Re: when validate-item [message #420282 is a reply to message #419526] Fri, 28 August 2009 02:33 Go to previous messageGo to next message
lancee
Messages: 11
Registered: August 2009
Location: Philippines
Junior Member

Is there some format for post-text-item trigger?

what should be my code all about.I'm sorry I'm new to oracle and not familiar to triggers.
This is my post-item code:

Declare
lv_def_where varchar2(32676); 
lv_dum_val varchar2(2000); 
begin 

lv_dum_val := :Coil_history.cpl_dtl; 
lv_def_where := 'Q1='||''''||lv_dum_val||''''; 
SET_BLOCK_PROPERTY(DATABLOCK,DEFAULT_WHERE LV_DEF_WHERE); go_item('query_item'); 
execute_query; 
end; 

Re: when validate-item [message #420286 is a reply to message #420282] Fri, 28 August 2009 03:15 Go to previous messageGo to next message
sharjeelshafqat
Messages: 33
Registered: August 2009
Location: Pakistan
Member

you send me you forms fmb file
i shall seet it and send back to you soon

thanks
Re: when validate-item [message #420292 is a reply to message #419526] Fri, 28 August 2009 03:56 Go to previous messageGo to next message
lancee
Messages: 11
Registered: August 2009
Location: Philippines
Junior Member

This is the fmb file and the when-validate-item trigger that I just revise.

I get a prompt message when I input either one of them but my problem now, is that I could not save the value I input ST/NST at the cpl_dtl.

Thanks in Advance!

[Updated on: Fri, 28 August 2009 03:57]

Report message to a moderator

Re: when validate-item [message #420294 is a reply to message #419526] Fri, 28 August 2009 03:58 Go to previous messageGo to next message
lancee
Messages: 11
Registered: August 2009
Location: Philippines
Junior Member

the fmb file attachment I forgot.


Thanks!
Re: when validate-item [message #423019 is a reply to message #420294] Mon, 21 September 2009 19:33 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Did you solve your problem?

David
Re: when validate-item [message #423022 is a reply to message #423019] Mon, 21 September 2009 19:47 Go to previous message
lancee
Messages: 11
Registered: August 2009
Location: Philippines
Junior Member

Actually I already got the solution.

Thanks for all the reply and comments.
Previous Topic: reading stream files oracle
Next Topic: diffcult issue in accessing Lob object and functions?
Goto Forum:
  


Current Time: Fri Sep 30 02:13:26 CDT 2016

Total time taken to generate the page: 0.23518 seconds