When check box changed trigger not working [message #629144] |
Wed, 03 December 2014 15:24 |
|
megha2525
Messages: 62 Registered: June 2012 Location: columbus
|
Member |
|
|
Hi All,
I am working Oracle forms 10g.I do have a master detail form . Master block is based on cards table and the detail block is based on Transactions table.
The detail block has a database column - Reviewed which is a check box.
For example,if the detail block had 4 records and the if the user checks the item 'Reviewed' for 3 records, when the user clicks the save button at the top ,
an alert should pop up.
I have set up an alert for the pop up message.
But my issue is that the pop up message is coming up all the time when the user clicks save button all the time.
Please help.
Thanks
Megha
|
|
|
|
Re: When check box changed trigger not working [message #629149 is a reply to message #629146] |
Wed, 03 December 2014 18:41 |
|
megha2525
Messages: 62 Registered: June 2012 Location: columbus
|
Member |
|
|
Hi Craig,
I have the following in the when-checkbox-changed trigger at the form level.
if :trans.reviewed_flag = 'Y' THEN
cl_button := Show_Alert('caution');
IF cl_button = ALERT_BUTTON1 THEN
:trans.reviewed_by := v_fullname;
Set_Item_Instance_Property('TRANS.REVIEWED_FLAG',CURRENT_RECORD,UPDATE_ALLOWED,PROPERTY_FALSE);
ElSIF cl_button = ALERT_BUTTON2 THEN
Set_Item_Instance_Property('TRANS.REVIEWED_FLAG',CURRENT_RECORD,UPDATE_ALLOWED,PROPERTY_TRUE);
:trans.reviewed_flag := 'N';
END IF;
end if;
on the property palette of the alert button , I have set the Button 1 Label as OK ; Button 2 Label as Cancel. Default Alert Button is set to Button 1.
Once the user checks the reviewed check box and it is saved to the database , the user cannot uncheck the reviewed check box.Hence the code.
Thanks
Megha
[Updated on: Wed, 03 December 2014 18:48] Report message to a moderator
|
|
|
|
|
|
|
|
Re: When check box changed trigger not working [message #629219 is a reply to message #629218] |
Thu, 04 December 2014 09:19 |
|
megha2525
Messages: 62 Registered: June 2012 Location: columbus
|
Member |
|
|
Thank you Cookiemonster.
The pre commit trigger works as per the requirement as in it fires only once when I hit save.
This is the code I have in the pre commit trigger at form level.
declare
cl_button NUMBER;
v_fullname pcard.transactions.reviewed_by%type;
v_userid pcard.transactions.reviewed_by%type;
begin
v_userid:=FND_PROFILE.VALUE('USER_ID');
select hr.full_name into v_fullname
from hr.per_all_people_f hr,
applsys.fnd_user fnd
WHERE (hr.person_id = fnd.employee_id)
and fnd.user_id=v_userid
and hr.effective_end_date > sysdate;
if :trans.reviewed_flag = 'Y' THEN
cl_button := Show_Alert('caution');
IF cl_button = ALERT_BUTTON1 THEN
:trans.reviewed_by := v_fullname;
Set_Item_Instance_Property('TRANS.REVIEWED_FLAG',CURRENT_RECORD,UPDATE_ALLOWED,PROPERTY_FALSE);
ElSIF cl_button = ALERT_BUTTON2 THEN
Set_Item_Instance_Property('TRANS.REVIEWED_FLAG',CURRENT_RECORD,UPDATE_ALLOWED,PROPERTY_TRUE);
:trans.reviewed_flag := 'N';
END IF;
end if;
end;
Since, I want all the 3 out of 4 records that have 'reviewed' checked to be saved to the database I put the following code in pre -update trigger at form level.
update transactions
set
reviewed_flag = :trans.reviewed_flag,
reviewed_by = :trans.reviewed_by,
last_update_date = sysdate
where transaction_id = :trans.transaction_id;
But it is updating only one record to the database. Which trigger should I be using to update all the 3 records to the database ? and also once a record has been saved to database as checked, it should not be unchecked again.
Please help.
Thanks
Megha
[Updated on: Thu, 04 December 2014 09:22] Report message to a moderator
|
|
|
Re: When check box changed trigger not working [message #629228 is a reply to message #629219] |
Thu, 04 December 2014 13:28 |
|
megha2525
Messages: 62 Registered: June 2012 Location: columbus
|
Member |
|
|
Hi All,
Thanks for all the help. I resolved this using the pre update trigger and the pre commit trigger. I have the code for the alert message in the pre commit trigger and the code to update the database is in the pre update trigger and it works.
Thanks
Megha
|
|
|