Detecting item field change [message #517548] |
Tue, 26 July 2011 10:02 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/73da323c315e8b6678fff9aac9cc8cce?s=64&d=mm&r=g) |
msdtjw
Messages: 25 Registered: March 2011
|
Junior Member |
|
|
Hello
I have a form that i need to be able to detect when a field is has been updated. I will then do the appropriate update to the table.
I can't use the standard oracle forms data block for handling updates because my data selection is controlled by me via the when-new-block-instance.
The problem is when i select a value from an LOV and place the new data in the field. I don't know how to detect if the field is updated or not. I am currently using a loop to cycle through all the records, I have an if/else in the key_commit trigger that basically determines if there is an update or insert to be done to the table. The problem is that it seems if i select a value for one record that record goes through the INSERT procedure, (which is correct), but all the other records(not touched/changed) are going through the UPDATE procedure.
Is there a way in forms to check the status of a field? I know of system.form_status but that does not work for me.
Thanks
|
|
|
Re: Detecting item field change [message #517554 is a reply to message #517548] |
Tue, 26 July 2011 10:16 ![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: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Changing any item will cause it's when-validate-item trigger to fire. Other methods only work with DB blocks.
However I'd recommend basing the block on a procedure instead - it'll be easier in the long run as It'll allow you to use custom code to populate the block while still allowing oracles default update/insert processing to work.
|
|
|
|
Re: Detecting item field change [message #517710 is a reply to message #517709] |
Wed, 27 July 2011 07: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) |
cookiemonster
Messages: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
It's been a long time since I did a block based on a procedure, but from memory:
Oracle can track which rows have been inserted/updated. It'll pass the rows that need to inserted/updated to the appropriate insert/update procedure.
I can't remember whether or not it uses rowid. I suggest you read up on it in the online help / documentation.
You certainly won't need to code a loop in the form to check.
|
|
|
|
|
|
|
|
Re: Detecting item field change [message #520431 is a reply to message #520430] |
Mon, 22 August 2011 10:47 ![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: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
msdtjw wrote on Mon, 22 August 2011 16:40The procedure package spec/body compile fine in the form
?
You don't compile DB packages in forms. Are you creating this package in the form?
|
|
|
|
|
|
|
Re: Detecting item field change [message #520439 is a reply to message #520437] |
Mon, 22 August 2011 11: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) |
cookiemonster
Messages: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Ask Oracle, as far as I'm aware that's just the way it's designed. Though obviously every other potential block source has to be in the DB, why should packages be any different?
|
|
|
|
|