When validate trigger block level
Hi,
I Have a form application. On the entrance page If a user forget to enter his name or Password the form prompt the message to aware him about what is missing.
SO I wrote the folloing code on when validate trigger block level, but it did not work according to my needs, should I replace this trigger with other?
Sharbat
BEGIN
if:Block1.User is null then
message('Please enter the user name);
raise form_trigger_failure;
if:Block1.password is null then
message('Please enter the password'););
raise form_trigger_failure;
end if;
end if;
end;
use
if:Block1.User is null then
message('Please enter the user name);
raise form_trigger_failure;
end if;
on key-next-item of user textbox
and
if:Block1.password is null then
message('Please enter the password'););
raise form_trigger_failure;
end if;
on the key-next-item of the password text box
Similar Messages
-
Problem with when validate trigger
Hi All,
I am using oracle forms 10g.
I have developed a custom form In that i have two block Header block and Detail block.In the header block some fields like Po number, po amount , supplier name, supplier site etc. And in the detail block i have po line details.
I have written a validation trigger under supplier name and supplier site, IF block.supplier_name is null then
message('enter supplier name') same under every field.
Now when the user enter po number it will go to po amount field and now when the user press tab it will go to the details block and query all the po related line,so i have written key-next under po_amount go-block and my code, Its works fine and giving the correct output. But the problem is When validate trigger fires when i press tab in PO Amount fields, Once i press ok it going to details block and querying.
Can any one explain me what i have done wrong. The validation trigger is firing and giving message.
Regards
SrikkanthSrikkanth.M wrote:
Hi All,
I am using oracle forms 10g.
I have developed a custom form In that i have two block Header block and Detail block.In the header block some fields like Po number, po amount , supplier name, supplier site etc. And in the detail block i have po line details.
I have written a validation trigger under supplier name and supplier site, IF block.supplier_name is null then
message('enter supplier name') same under every field.
Now when the user enter po number it will go to po amount field and now when the user press tab it will go to the details block and query all the po related line,so i have written key-next under po_amount go-block and my code, Its works fine and giving the correct output. But the problem is When validate trigger fires when i press tab in PO Amount fields, Once i press ok it going to details block and querying.Hey, Srikkanth
Once you said
when the user enter po number it will go to po amount field and now when the user press tab it will go to the details block and query all the po related line,so i have written key-next under po_amount go-block and my code, Its works fine and giving the correct output.again you said
But the problem is When validate trigger fires when i press tab in PO Amount fieldsSo, i'm not getting you..
Can you clear it any more ? or any other way.. -
WHEN-VALIDATE-TRIGGER trigger looping so many times
Hi,
Below is the code written in WHEN-VALIDATE-TRIGGER trigger and after raise FORM-TRIGGER_FAILURE
the process is not stopping and the trigger message looping without end when
I tab to the next field or try to save the record. I am not sure why the flow did not stop
after the raise FORM_TRIGGER_FAILURE exception and the trigger looping again and again.
Please help me to know what is wrong in the code. This trigger written in ITEM level.
declare
msg_type varchar2(3);
msg_text varchar2(2000);
continue boolean;
begin
if :pom1_b22.qty < 0 then
message_ppkg.get_msg_from_db('RET','04060',msg_type,msg_text);
message(msg_text || '.');
bell;
raise form_trigger_failure;
else
continue := TRUE;
if :pom1_b22.qty is not null and :pom1_b22a.b22_query = 'FALSE' then
if nvl(:pom1_b22.irt_created,'N') = 'Y' then
if :pom1_b22.qty <> :pom1_b22.save_qty and
:pom1_b22.save_qty is not null then
if check_order_status then
continue := TRUE;
else
continue := FALSE;
message_ppkg.get_msg_from_db('RET','04061',msg_type,msg_text);
message(msg_text);
bell;
:pom1_b22.qty := :pom1_b22.save_qty;
raise form_trigger_failure;
end if;
end if;
end if;
if continue then
if :pom1_b22.save_qty is null then
if :pom1_b22.qty > :pom1_b22a.total_qty then
message_ppkg.get_msg_from_db('RET','04057',msg_type,msg_text);
message(msg_text || to_char(:pom1_b22a.total_qty) || '.');
bell;
raise form_trigger_failure;
end if;
else
if :pom1_b22.qty <> nvl(:pom1_b22.save_qty,0) then
if :pom1_b22.qty > :pom1_b22a.total_qty +
(nvl(:pom1_b22.save_qty,0) -
:pom1_b22.qty) then
message_ppkg.get_msg_from_db('RET','04056',msg_type,msg_text);
message(msg_text || to_char(:pom1_b22a.total_qty +
(nvl(:pom1_b22.save_qty,0) -
:pom1_b22.qty)));
bell;
raise form_trigger_failure;
end if;
end if;
end if;
end if;
end if;
end if;
end;Your Raise form_Trigger_failure Condition is not met hence not stopping the rest trigger body.
-
When validate trigger forms 6i
Please help me to create when validate item trigger.
There is one table "job" - id, status
status is X or null. i want to do in forms. when someone is entering value for id, it should check first the status for that id in job table status field.
if status is null then it should show msg "this id is already open for another job"
Edited by: only.ashish99 on Dec 26, 2012 1:44 PMHi,
So You mean that if the user dosent enter the staus then u need to show a message and if the entered status is there in ur table and then u need to show a message.
Just write in the when validate trigger
declare
v_status number;
begin
select count(status) into v_status from table;
If :Block.field_name is null then
message('');
Else
If v_status=0 then
ur action
else
Message('this job is exist for another');
End if;
end if;
End;
Try this.
Regards
Sri -
Issue with When Validate Trigger firing multiple times
Hi guys,
I have Designed a Form Personalization on a Form which Fires a concurrent Program (built in:execute Procedure) when a Record is Saved.
Below are the issues I am facing:
1.Concurrent Program is Firing Multiple Times after Saving the Record.
2.2 input Values to Concurrent Program are passed as NULL though I have Data but they are in Different Block of Form.
Note :I have When Validate trigger on 1 Block but i am trying to pass 2 Values on Another Block as input parameters for Concurrent program.But those values are getting as null when program fires.
Thanks.If EBS then post in {forum:id=475}
-
Problem using when-validate-trigger
Dear Experts,
After validating a item value, I want to navigate to a specified item besed on that item value. If i use go_item('item1') in when-validate-trigger, error comes, beacuse we cannot use restricted built-in go_item in when-validate-trigger. If i use key-next-item on 'item1' for validating item value then while navigating through mouse it does'nt fire.
Please let me know which triiger i should use?
Thanks
Abhishek RustagiThere is no easy way to do this, however you could create a timer in your when-validate-item trigger which expires immediately, and place all of your navigational code in the when-timer-expired trigger - this way you could check the value which has been entered and navigate accordingly.
-
Problem in using when-validate-trigger
Dear Experts,
After validating a item value, I want to navigate to a specified item besed on that item value. If i use go_item('item1') in when-validate-trigger, error comes, beacuse we cannot use restricted built-in go_item in when-validate-trigger. If i use key-next-item on 'item1' for validating item value then while navigating through mouse it does'nt fire.
Please let me know which triiger i should use?
Thanks
Abhishek RustagiHi, the way I use to solve this problem is using both: key-next-item and when-validate-item. In the w-v-i you make the validations you need (this control mouse navigation) and in the k-n-i code write:
-- first validate the values, to avoid invalid values
execute_trigger ('when-validate-item');
-- if trigger fire corectly then you can go to the item you want..
if my_item = 'A' then
go_item(my_next_item1);
elsif my_item = 'B' then
go_item(my_next_item2);
end if;
Ruben. -
Hi All
I want message('please check the order');
and my code is
DECLARE
a VARCHAR2(200);
b varchar2(200);
BEGIN
select s.sale_order_no||sd.prod_id||sd.color,s.PERFORMA_TYPE INTO a,b from sale_order s,sale_order_detail sd
where s.id=sd.id and s.sale_order_no||sd.prod_id||sd.color=:gin_detail1.barcode and s.PERFORMA_TYPE!='ORDER CANCEL';
IF :gin_detail1.barcode = a THEN
SELECT SALE_ORDER_NO,prod_id,style,color,xs,s,m,l,xl,pcs INTO :gin_detail1.sale_order_id,:gin_detail1.prod_id,
:gin_detail1.prod_name,:gin_detail1.color,:gin_detail1.xs,:gin_detail1.s,:gin_detail1.m,:gin_detail1.l,
:gin_detail1.xl,:gin_detail1.pcs from sale_order_barcode where barcode=:gin_detail1.barcode;
ELSE
message('please check the order');
end if;
end;when-validate-item trigger raised unhandeled exception ora-01403
Thanks And Regards
Vikas SinghalHi,
Probably your first select statement itself throwing the error - ora-01403
So may be try to include an exception part for your code, to catch the exception ora-01403 -no data found
and there display the messgae- 'Please check the Order'.
Hope it will work then -
How to invoke when-validate trigger
Hi all ,
I just want to know how can i Invoke when-validate-item trigger of another item by without navigating to that item.
Exampls. I have two items A and B
I want to invoke item B's when-validate-item trigger by keeping the focus on A or being in A .first: write procedures for each when-validate.
e.g. WVI_name_of_the_item_A and WVI_name_of_the_item_B
then you start this procedure in item A and the other in item B.
now you can use the validation-procedure of B inside the validation of A
try it
Gerd -
When Validate Trigger is getting executed when Execute_query
i have a data block in which i have 2 text item. i have defined when validate item.
when the form is starting up i have given execute_query. before fetching the values my when validate item is getting executed. i dont want to do this. can one help me out in this caseHi,
Can you pls. check any initial value is given or not? Otherwise for quick solution you can declare a parameter upon which when-validate will validate the value. You can change value before and after 'EXECUTE_QUERY' statement. This is not a good idea. -
DECLARE
PO_TSF_INDICATOR VARCHAR2(1);
LOC_TYPE VARCHAR2(10);
TSF_FROM_LOCATION VARCHAR2(50);
PO_SUPP NUMBER(10);
QTY NUMBER(12,4);
BEGIN
IF :SYSTEM.RECORD_STATUS = 'CHANGED' THEN
PO_TSF_INDICATOR := TRIM(:B_REQUEST.LI_PO_TSF_IND);
LOC_TYPE := TRIM(:B_REQUEST.LI_REQUEST_LOC_TYPE);
TSF_FROM_LOCATION := TRIM(:B_REQUEST.TI_TSF_FROM_LOC);
PO_SUPP := TRIM(:B_REQUEST.TI_PO_SUPPLIER);
QTY := TRIM(:B_REQUEST.TI_FULFILLED_QTY);
IF PO_TSF_INDICATOR = 'P' THEN
EMESSAGE('PO_TSF_INDICATOR IS "P" ');
UPDATE AFE_STORE_ORDERS
SET PO_TSF_IND = PO_TSF_INDICATOR,
PO_SUPPLIER = PO_SUPP,
FULFILLED_QTY = QTY,
TSF_LOC_TYPE=' ',
TSF_FROM_LOC=' '
WHERE ITEM = TRIM(:B_REQUEST.TI_ITEM);
EMESSAGE('PO-TSF-INDICATOR :' || PO_TSF_INDICATOR);
EMESSAGE('PO-SUPPLIER:' || PO_SUPP);
EMESSAGE('QTY :' || QTY);
COMMIT;
ELSIF PO_TSF_INDICATOR = 'T' THEN
EMESSAGE('PO_TSF_INDICATOR IS "T" ');
UPDATE AFE_STORE_ORDERS
SET PO_TSF_IND = PO_TSF_INDICATOR,
TSF_LOC_TYPE = LOC_TYPE,
TSF_FROM_LOC = TSF_FROM_LOCATION,
FULFILLED_QTY = QTY,
PO_SUPPLIER = ' '
WHERE ITEM = TRIM(:B_REQUEST.TI_ITEM);
EMESSAGE('PO-TSF-INDICATOR :' || PO_TSF_INDICATOR);
EMESSAGE('LOC-TYPE :' || LOC_TYPE);
EMESSAGE('TSF-FROM-LOC :' || TSF_FROM_LOCATION);
EMESSAGE('QTY :' || QTY);
END IF;
END IF;
END;
This is trigger written in when validate record. Now the problem is, update statement isnt working ....Is it like in when validate record (block level), update command dont work ? And is when validate record trigger (when written at the block level) will fire for each record (if its multi record block) ? Please clarify ..
Regards
Message was edited by:
SeshuHi,
As suggested by you, I have written the code in on-update trigger (block level)
EMESSAGE('ON UPDATE TRIGGER');
:GLOBAL.QTY := TRIM(:TI_FULFILLED_QTY);
IF :GLOBAL.IND = 'P' THEN
EMESSAGE('INSIDE "P" LOOP"');
UPDATE AFE_STORE_ORDERS
SET PO_TSF_IND = :GLOBAL.IND,
PO_SUPPLIER = :GLOBAL.PO_SUPPLIER,
FULFILLED_QTY = :GLOBAL.QTY,
TSF_FROM_LOC = ' ',
TSF_LOC_TYPE = ' '
WHERE ITEM = TRIM(:B_REQUEST.TI_ITEM);
COMMIT;
EMESSAGE('RECORD UPDATED');
ELSIF :GLOBAL.IND = 'T' THEN
EMESSAGE('INSIDE "T" LOOP"');
EMESSAGE(:GLOBAL.IND);
EMESSAGE(:GLOBAL.QTY);
EMESSAGE(:GLOBAL.FROM_LOC);
EMESSAGE(:GLOBAL.LOC_TYPE);
BEGIN
UPDATE AFE_STORE_ORDERS
SET PO_TSF_IND = :GLOBAL.IND,
PO_SUPPLIER = null,
FULFILLED_QTY = TO_NUMBER(:GLOBAL.QTY),
TSF_FROM_LOC = TO_NUMBER(:GLOBAL.FROM_LOC) ,
TSF_LOC_TYPE = :GLOBAL.LOC_TYPE
WHERE ITEM = TRIM(:B_REQUEST.TI_ITEM);
commit;
EMESSAGE('RECORD UPDATED');
EXCEPTION
WHEN OTHERS THEN
EMESSAGE(SQLERRM);
END;
END IF;
ERASE ('GLOBAL.IND');
ERASE ('GLOBAL.QTY');
ERASE ('GLOBAL.FROM_LOC');
ERASE ('GLOBAL.LOC_TYPE');
ERASE ('GLOBAL.PO_SUPPLIER');
Tell me how am i to know whether its getting fired or not ? because, i cant see message being populated
Regards -
When-validate-record trigger only if a non database item is changed
Hi,
I am trying a code in the when-vaidate-record trigger in the BLOCK level.
The trigger should fire only if a checkbox item value is ticked(Value ='Y) for the present record(i.e, if already existing other records have a value ticked (='Y), it doesnt matter and trigger shouldnt fire)
Please help me achieve this :
The code I have tried in when-vaidate-trigger, which does not work as what I want :
DECLARE
X NUMBER;
BEGIN
if
nvl ( :DEFLOC.to_be_defaulted, 'N' ) = 'Y' and :DEFLOC.COMMENTS is NULL
and :SYSTEM.RECORD_STATUS ='CHANGED'
then
set_alert_property(
'err_alert',
alert_message_text,
'You must enter a comment when defaulting localities.');
x := show_alert('err_alert');
RAISE FORM_TRIGGER_FAILURE;
end if;
END;The above code does not fire at all..
If I remove the part,
and :SYSTEM.RECORD_STATUS ='CHANGED'
it fires for "all records"(not just the currently changed records) where nvl ( :DEFLOC.to_be_defaulted, 'N' ) = 'Y' and :DEFLOC.COMMENTS is NULL
Please help !!
Note: :DEFLOC.to_be_defaulted is a non database item ; :DEFLOC.COMMENTS is a database itemHi kriti,
There is one more way,
In the when-checkbox-changed trigger,
if :your_chk_box = 'Y' then
set_Record_property(:system.cursor_Record, 'your_blk',status,changed_Status);
else
set_Record_property(:system.cursor_Record, 'your_blk',status,Query_Status);
end if;
Then it is easy for you to find out the changed records using get_Record_property((:system.cursor_Record, 'your_blk',status)
Hey let me ask you one Question, is that check_box item is database item ???
If so,
it is easier..the fol. code will work for that
if nvl ( :DEFLOC.to_be_defaulted, 'N' ) = 'Y' and :DEFLOC.COMMENTS is NULL
and nvl(get_item_property('DEFLOC.to_be_defaulted',database_value),'N') = 'N' then
set_alert_property(
'err_alert',
alert_message_text,
'You must enter a comment when defaulting localities.');
x := show_alert('err_alert');
RAISE FORM_TRIGGER_FAILURE;
end if;otherwise
If your are creating that temp. item, it should be in the same block as non-db item.
I will explain this... You are setting the status of to_be_defaulted check box of some queried record to Y based on some conditions, right?
These records anyways are not updateable. Now your requirement is to find out the newly checked check boxes.
So in the post query or the place where you set to_be_defaulted as 'Y, we will default the new item with value Y, so that in the when validate trigger, you
know which record needs to attacked, It is those records with nvl( new item ,'N') = 'N' and to_be_defaulted = 'Y'...
Regards
Dora... -
Problem while handling When-Validate-Record Trigger in Forms 6i
I am using below mention code in when validate trigger and use go block loop in when button pressed. if Check_Date_Range gives RAISE Form_Trigger_Failure error user will enter in a loop. kindly provide me solution for below mention problem.
BEGIN
Check_Date_Range(:Experiment.Start_Date,:Experiment.End_Date);
END;
** The procedure looks like this
PROCEDURE Check_Date_Range( d1 DATE, d2 DATE ) IS
BEGIN
IF d1 > d2 THEN
Message('Your date range ends before it starts!');
RAISE Form_Trigger_Failure;
END IF;
END;You have more chance to find a response if you post into Forms<br>
<br>
Nicolas. -
Unable to validate the text with validate trigger
Hi I am facing one issue
I want to validate the password before going to another field, i put the following code on the when validate trigger,what i want if the password is wrong the cursor should go to the password field and clear the contents of that field only.When i put go_item and clear_item its giving error,pls find the following error and my code
FRM-40737:Illegal restricted procedure Clear_block in when validate Item trigger
declare
l_user varchar2(6) := null;
l_pass varchar2(10);
n_pass varchar2(10);
chkbutton number;
chk number;
Begin
select passwd into l_pass
from Trx_usr
where username = :USR.DISUSR;
if :global.pass = :TRX.PASSWD then
message('Login Sucesss');
else
chk:=show_alert('ALRLOG');
if chk = alert_button1 then
go_item('TRX.PASSWD');
clear_item;
end if;
end if;
end;
rgds
shreyI guess go call that code in the WHEN-VALIDATE-ITEM-trigger of the password-field itself? So you don't need any GO_ITEM. And instead of using CLEAR_ITEM you can just assign NULL; like
:TRX.PASSWD:=NULL; -
When-validate-item firing on block level.
Hi all
i have six fields and when-validate-item trigger is working on block level, i want to display records in one field,i want when-validate-item trigger work on item level not on block level,any help will be greatly appreciated.
here is the code.
When-Validate-Item Trigger.
declare
Str_Space VARCHAR2(20);
begin
Str_Space := ' ';
:ins1.ref := :ins1.branch || Str_Space || :ins1.class || Str_Space || :ins1.year || Str_Space || :ins1.serial || Str_Space || :ins1.cno || Str_Space || :ins1.edno;
end;
sarahFrancois Degrelle.
just look the following code.
DECLARE
Str_Space VARCHAR2(20);
begin
Str_Space := ' ';
:ins1.ref := :ins1.branch || Str_Space || :ins1.class || Str_Space || :ins1.year || Str_Space || :ins1.serial || Str_Space || :ins1.cno || Str_Space || :ins1.edno;
END;
by using the above code i am passing branch,class,year,serial,cno and edno to Ref column( 1 G01 2009 13112 00 01). and Str_space variable is creating space for each item.i want the above code work at item leavel instead of block level.Is it poassibl?
sarah
Maybe you are looking for
-
Hi, I'm displaying a list in a grid using OOABAP Global classes. 1)Could anyone post how to handle the end-of-page events in this case. 2) Also in this case I've to code for Interactive Reporting, So also please say how to handle this parallelly for
-
AP. Adjusting Selected Invoices for Manual Payments
Hi We have the problem when Adjusting Selected Invoices for Manual Payments: The system does not prevent user from the adjusting invoices on cleared payments, though in Oracle Payables User Guid is said: "You cannot adjust invoices on a cleared payme
-
Hi, I would like to learn about ABAP Mapping. What is the importance of it and where it is applied? Could you please guide me regarding this? Thanks, Raja Bala
-
ESB: inbound file and outbound ftp adapter with multiple directories
Basically I want to scan directories and write new files ftp directories. I could figure out how to do that for one directory. However I need to scan multiple directories and ftp upload files contained in those directories to corresponding ftp direct
-
How to configure PO workflow in ECC
Hi All, I have worked on SRM Workflow, but i need your help on ECC Workflow for Purchase Order. Requirement is to have : PO released through workflow. I need the steps for making the workflow to work. Thanks, Anil