Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to identify a new record (not saved)?

Re: How to identify a new record (not saved)?

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 5 Oct 2002 11:50:38 -0700
Message-ID: <92eeeff0.0210051050.3a9e3966@posting.google.com>


"Nick" <aroughguy_at_nsp.toughguy.net> wrote in message news:<9_Cn9.12273$Sr6.399198_at_ozemail.com.au>...
> Hi
>
> In my master-detail form, I have a command button to delete the currently
> selected record in a detail block.
>
> Since users may click this delete button after they created a new record but
> have not saved yet, I want to disable this button in that case (the current
> record is a new record which has not been saved yet) or display a message
> that "the record has not been saved".
>
> I have thought of this way: creating a cursor of the underlying table's
> primary key, then loop through to find the current primary key value in the
> form. If it is not found then it means the record has not been saved yet. I
> think this may be slow when the table grows larger (like millions of rows)
>
> However, I believe there must be a better way. I appreciate if someone can
> give some hint?
>
> Thanks
> Nick

You neglected to mention your development tool e.g. VB, VC++ etc.

In any case, most Windows development tools have same properties for controls. Assuming your detail block is a Table window then Table window control has certain constant properties e.g. ROW flags could be ROW_Edited, ROW_New, ROW_MarkDeleted etc. In a table window, these flags are set depending on the action.

Query on the ROW flags. If flag is ROW_New then just clear the row without any server call. Otherwise mark the row or rows as ROW_MarkDeleted. Clicking on Save button deletes all marked rows.

This logic gives you atleast one direction to work with.

/Rauf Sarwar Received on Sat Oct 05 2002 - 13:50:38 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US