|
|
|
Re: Insert/Update/Delete single record at a time [message #132457 is a reply to message #132084] |
Fri, 12 August 2005 18:24 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/67467.jpg) |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
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] Report message to a moderator
|
|
|
Re: Insert/Update/Delete single record at a time [message #132593 is a reply to message #132566] |
Mon, 15 August 2005 01:30 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/67467.jpg) |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
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] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
Re: Insert/Update/Delete single record at a time [message #135067 is a reply to message #134898] |
Mon, 29 August 2005 14:11 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
|
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 #410803 is a reply to message #135067] |
Tue, 30 June 2009 06:10 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
adnan19cn
Messages: 7 Registered: June 2009 Location: Karachi
|
Junior Member |
|
|
Hi
Please help me, i am also stuck with this requirement.
I also want to restrict insertion/deletion/updation if a record changed or inserted. I want thing like "save changes first".
urgent reply shall be highly appreciated.
Thanks,
Adnan..
|
|
|
|
|
|
Re: Insert/Update/Delete single record at a time [message #410938 is a reply to message #410931] |
Wed, 01 July 2009 01:44 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
adnan19cn
Messages: 7 Registered: June 2009 Location: Karachi
|
Junior Member |
|
|
Hi David,
I am using this on When_Validate_Record at Block Level;
IF :system.Record_Status In ('CHANGED', 'INSERT') Then
MESSAGE('Save Changes First');
MESSAGE('Save Changes First');
RAISE FORM_TRIGGER_FAILURE;
END IF;
It works fine but do not saves when I press save button on my form. Any suggestion?
I cant have it on When_new_form_instance because i want to check for both New or Updated record. I just need a trigger name or any other suggestion that could get me rid from this.
Regards,
Adnan..
|
|
|
Re: Insert/Update/Delete single record at a time [message #410952 is a reply to message #132084] |
Wed, 01 July 2009 04:22 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13963 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 #410957 is a reply to message #410953] |
Wed, 01 July 2009 05:12 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
adnan19cn
Messages: 7 Registered: June 2009 Location: Karachi
|
Junior Member |
|
|
Well I have done the following but its on item level validation not on record level. When I use this on record level validation then if come up with a error 'Unable to Insert' and allows to navigate on other record without saving.
At Form Level:
1)
When-New-Forms-Instance
:global.ina:=0;
2)
Key-Commit
:global.ina:=1;
commit_form;
:global.ina:=0;
At Block Level:
1)
IF :SYSTEM.RECORD_STATUS IN ('CHANGED','INSERT') and :global.ina=0 THEN
RAISE FORM_TRIGGER_FAILURE;
END IF;
May someone found this helpful. But I am still waiting for help on my scenario.
Thanks,
Adnan..
|
|
|
Re: Insert/Update/Delete single record at a time [message #410991 is a reply to message #132084] |
Wed, 01 July 2009 07:41 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13963 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;
|
|
|
|
|
|
|
Re: Insert/Update/Delete single record at a time [message #446929 is a reply to message #443261] |
Thu, 11 March 2010 00:34 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/67467.jpg) |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
Sorry that I have been so long in replying. Have you solved your problem?
You THINK that you haven't changed anything! Use the debugger and run through the form line-by-line. Somewhere in the code there is an assignment to a database item.
David
|
|
|