|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Display a value instead of NULL in a DataBlock Item... [message #540641 is a reply to message #539736] |
Wed, 25 January 2012 01: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) |
![](http://www.orafaq.com/forum/images/custom_avatars/75489.jpg) |
azamkhan
Messages: 557 Registered: August 2005
|
Senior Member |
|
|
SET_RECORD_PROPERTY:
Sets the specified record property to the specified value.
On Post-Query trigger using NVL function replace the null value with -1 and populate it in your base table item value like this
:my_colmun := Nvl(:my_Colmun, -1);
And just after this update, issue the SET_RECORD_PROPERTY and change its status to query.
In this way you can show -1 in your data base column without adding any non-database column... ![Smile](images/smiley_icons/icon_smile.gif)
And because you have force fully changed the record status to QUERY, form will not ask you to save the changes
[Updated on: Wed, 25 January 2012 02:03] Report message to a moderator
|
|
|
|
|
|
Re: Display a value instead of NULL in a DataBlock Item... [message #540648 is a reply to message #540647] |
Wed, 25 January 2012 02:59 ![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 |
|
|
As I said back up the thread, if you want to make the DB column hold -1 instead of null you should just update the column and make it not null. If you don't then you can't set the db item in the form to -1 since, as LF points out, sooner or later that value will end up in the DB.
For this reason it makes no sense to ever assign a value to a db item post-query.
|
|
|
|
|
Re: Display a value instead of NULL in a DataBlock Item... [message #541882 is a reply to message #541871] |
Fri, 03 February 2012 00:07 ![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) |
![](http://www.orafaq.com/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
This will cause DUP-VAL-ON-INDEX (if the index exists, that is) or duplicate records (if the index doesn't exist), because Forms will insert a record in its default processing, and you'll try to do the same with the INSERT statement. That's probably not a good idea.
As of displaying -1 instead of NULL using the NVL function, it was discussed previously. Did you read what's being said, or do you just answer the first message and discard what other people said?
[Updated on: Fri, 03 February 2012 00:08] Report message to a moderator
|
|
|
Re: Display a value instead of NULL in a DataBlock Item... [message #541915 is a reply to message #541882] |
Fri, 03 February 2012 03:06 ![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 |
|
|
Littlefoot wrote on Fri, 03 February 2012 06:07This will cause DUP-VAL-ON-INDEX (if the index exists, that is) or duplicate records (if the index doesn't exist), because Forms will insert a record in its default processing, and you'll try to do the same with the INSERT statement. That's probably not a good idea.
Actually no - on-insert overrides default processing.
That said I've already pointed out the correct approach if you want to store -1 further up the thread. on-insert is not involved.
And why you would write an on-insert trigger when you could just assign the value to the appropriate datablock item in pre-insert I don't know.
As far as I'm concerned if you need to use an on trigger you've got a design flaw somewhere.
|
|
|
|