|
|
|
| Re: Insert/Update/Delete single record at a time [message #132457 is a reply to message #132084] |
Fri, 12 August 2005 18:24   |
m_ashtiani Messages: 27 Registered: August 2005 Location: Reno |
Junior Member |
|
|
you have to trap up,down, next_record, previous_record triggers
if you have tab pages or next/previous block then you have to trap them too. p.s. you may want to trap mouse click if you don't want them to change blocks either
simple example (block level triggers)
Key-down trigger:
execute_trigger('key-nxtRec');
Key-nxtRec trigger:
if get_block_propert('bolck_name', status ) in ('QUERY') then
next_record;
end if;
also beware of 'NEW' status
i am using my memory so i may have syntax errors above.
hope it helps
|
|
|
| Re: Insert/Update/Delete single record at a time [message #132515 is a reply to message #132084] |
Sat, 13 August 2005 14:57   |
oraclejo Messages: 50 Registered: July 2005 Location: Ammar |
Member |
|
|
I would suggest another technique
Oracle maintain Record and block status in SYSTEM vairables.
:SYSTEM.RECORD_STATUS can have the following values:
CHANGED, QUERY, NEW
QUERY MEANS that the RECORD is either already committed or has been queried but never changed. While trying to move out of the record , you can check the value of this SYSTEM vairable.
Another approach would be relying on the fact that the trigger when-validate-record fires if you navigate out of a record when changes are made to the current record. So if it fires, it means that there are changes to be committed, note that you have to handle the fact that when-validate-record also fires when a commit is performed
Ammar Sajdi
www.e-ammar.com
Regs
|
|
|
| Re: Insert/Update/Delete single record at a time [message #132566 is a reply to message #132515] |
Sun, 14 August 2005 19:56   |
 |
djmartin Messages: 9353 Registered: March 2005 Location: Canberra ACT Australia |
Senior Member |
|
|
Another approach is ... in the WVI trigger call a procedure which turns all the items 'OFF' and then turns, just this record's items, back 'ON'. Remember you can't 'enable' the current field, but you also couldn't disable it so test for the item instance status and if it is enabled don't re-enable it.
Of course, in the commit-form trigger you turn them all back 'ON' again.
David
[Updated on: Mon, 15 August 2005 01:33]
|
|
|
| Re: Insert/Update/Delete single record at a time [message #132593 is a reply to message #132566] |
Mon, 15 August 2005 01:30   |
oraclejo Messages: 50 Registered: July 2005 Location: Ammar |
Member |
|
|
Hi
I do not see how truning the item off, would prevent the commit operation from taking place. The question is how to stop navigation outside the record when there are changes to be committed for that particular record. And one record at a time.
Regards
Ammar Sajdi
www.e-ammar.com
|
|
|
| Re: Insert/Update/Delete single record at a time [message #132594 is a reply to message #132593] |
Mon, 15 August 2005 01:36   |
 |
djmartin Messages: 9353 Registered: March 2005 Location: Canberra ACT Australia |
Senior Member |
|
|
If an item is 'off' you can't navigate into it. Therefore, the user can't get out of the current record. 'OFF' means keyboard and mouse navigation disabled, insert, update, delete disabled. If you are still working in character mode you can disabled the field. Unfortunately, in GUI if you disable the field it decides 'greyed' out. This may or may not be okay.
This means that as soon as the user changes any field, only that record can be modified until the other fields are reactivated as part of the commit process.
I didn't think 'vojinle' wanted to stop the commit, 'vojinle' only wanted the user to modify a single record at a time.
David
[Updated on: Mon, 15 August 2005 01:39]
|
|
|
|
|
|
|
|
|
|
|
| Re: Insert/Update/Delete single record at a time [message #135067 is a reply to message #134898] |
Mon, 29 August 2005 14:11   |
vojinle Messages: 6 Registered: June 2005 |
Junior Member |
|
|
IF NAME_IN('GLOBAL.OUTLOOK')='Y' THEN
GO_RECORD(NAME_IN('GLOBAL.RECORD_NUMBER'));
MESSAGE('You cannot update more than one record if the Outlook box is checked');
RAISE FORM_TRIGGER_FAILURE;
END IF;
IF NAME_IN('SYSTEM.RECORD_STATUS') IN ('CHANGED','INSERT', 'NEW') THEN
COPY(NAME_IN('SYSTEM.CURSOR_RECORD'),'GLOBAL.RECORD_NUMBER');
END IF;
|
|
|
|
| Re: Insert/Update/Delete single record at a time [message #324588 is a reply to message #324587] |
Tue, 03 June 2008 04:20   |
|
My Requirement was goes like that
If the Records are Approved User shud not be able to Update it.
else he can make the Changes.I write on form level When-New-Record_Instance Trigger
IF :PARAMETER.P_AUTHORIZE = 'N' THEN
IF :GM_VEHICLE_JOBS.AUTHORIZE_DATE IS NULL THEN
SET_ITEM_PROPERTY('GM_VEHICLE_JOBS.MS_JOB_TYPE', UPDATE_ALLOWED, PROPERTY_TRUE);
RAISE FORM_TRIGGER_FAILURE;
END IF;
IF :GM_VEHICLE_JOBS.AUTHORIZE_DATE IS NOT NULL THEN
SET_ITEM_PROPERTY('GM_VEHICLE_JOBS.MS_JOB_TYPE', UPDATE_ALLOWED, PROPERTY_FALSE);
RAISE FORM_TRIGGER_FAILURE;
END IF;
ELSE
SET_ITEM_PROPERTY('GM_VEHICLE_JOBS.MS_JOB_TYPE', UPDATE_ALLOWED, PROPERTY_FALSE);
END IF;
Thanx and Regards
Javed A. Khan
|
|
|
|
|
|
|
|
| Re: Insert/Update/Delete single record at a time [message #410952 is a reply to message #132084] |
Wed, 01 July 2009 04:22   |
cookiemonster Messages: 1340 Registered: September 2008 Location: Rainy Manchester |
Senior Member |
|
|
Since when-validate-record has to complete without error before the record can be saved (which is the whole point of that trigger) that was never going to work.
There is no nice way of doing this in a multi-record block, but as djmartin suggested the best bet is to use a when-new-record-instance.
|
|
|
|
|
| Re: Insert/Update/Delete single record at a time [message #410991 is a reply to message #132084] |
Wed, 01 July 2009 07:41   |
cookiemonster Messages: 1340 Registered: September 2008 Location: Rainy Manchester |
Senior Member |
|
|
Try this in when-new-record-instance:
IF :system.block_status = 'CHANGED' THEN
IF show_alert('Do you want to save changes?') = ALERT_BUTTON1 THEN
commit_form;
ELSE
--user said no
go_record(:global.current_record);
raise form_trigger_failure;
END IF;
END IF;
:global.current_record := :system.cursor_record;
|
|
|
|
|
|