Re: DELETE_RECORD for empty item

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Sun, 11 Apr 2004 07:11:40 -0400
Message-ID: <WsGdne1ZfshluuTdRVn_iw_at_comcast.com>


"Malcolm Dew-Jones" <yf110_at_vtn1.victoria.tc.ca> wrote in message news:4078847a_at_news.victoria.tc.ca...
| I'm using Forms Developer 6i (I think - the full version information is at
| the end of this post, who knows what it means).
|
| A data entry form is set up like this... Each item on the form corresponds
| to the same column but in different rows of the table. I.e. If there are
| ten item fields on a form, and if values were entered in five of them then
| we would end up with five new rows in the table. (Each row is one of an
| arbitrary number of parameters, which is why it was originally set up this
| way.)
|
|
| The following problem occurs.
|
|
| The user enters a value in one field - a row is implicitly inserted.
|
| The user does other stuff.
|
| The user returns to that field and uses the backspace or delete key and
| removes all the characters.
|
| The column now has a null value, which isn't allowed.
|
| To continue, the underlying row must be deleted. The user can do this
| easily enough by simpy pressing a [Delete Current Record] button, but it
| is not obvious to the users that this needs to be done so they don't do
| it.
|
| My PROBLEM: how can I best detect the value has become set to null and
| automatically delete the underlying row?
|
| I can't detect this as an error and simply delete any rows with null
| values because the DELETE_RECORD builtin can't be called during an error
| handler.
|
| I looked up some likely looking triggers, e.g. WHEN-VALIDATE-RECORD, and
| POST-TEXT-ITEM, but both say they occur during navigation, which is
| exactly when the documentation says the restricted builtin DELETE_RECORD
| is not allowed to be run.
|
| So, I'm hoping for suggestions on how best to delete a row when the value
| in the field for the item is emptied.
|
| Thanks
|
| ------------------------------------
| Version from "About Form Builder..."
| ------------------------------------
|
| Forms [32 Bit] Version 6.0.8.8.0 (Production)
| Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
| With the Partitioning, OLAP and Oracle Data Mining options
| JServer Release 9.2.0.4.0 - Production
| Oracle Toolkit Version 6.0.8.12.1 (Production)
| PL/SQL Version 8.0.6.0.0 (Production)
| Oracle Procedure Builder V6.0.8.12.1 Build #520 - Production
| PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
| Oracle Query Builder 6.0.7.1.0 - Production
| Oracle Virtual Graphics System Version 6.0.5.37.0 (Production)
| Oracle Tools GUI Utilities Version 6.0.5.35.0 (Production)
| Oracle Multimedia Version 6.0.5.34.0 (Production)
| Oracle Tools Integration Version 6.0.8.13.0 (Production)
| Oracle Tools Common Area Version 6.0.5.32.1
| Oracle CORE Version 4.0.6.0.0 - Production
|

this may work (can't think of a cleaner way, but there may be)

set a flag (in a package variable, global variable, or control block item) in either the ON-ERROR or the ON-VALIDATE-ITEM trigger, then check that flag in a WHEN-NEW-ITEM-INSTANCE trigger

the WNII trigger would need to navigate to the proper record, perform the DELETE_RECORD, then navigate to the appropriate record

the location of the WNII and the contents of the flag(s) depends on the structure of you form -- single block form, put it at the block level to catch navigation within the block, multi-block form, put it at the form -- but you'll need to navigate back to the correct block and record

;-{ mcs Received on Sun Apr 11 2004 - 13:11:40 CEST

Original text of this message