Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!agate!shelby!portia!mouser From: mouser@portia.Stanford.EDU (Michael Wang) Newsgroups: comp.databases Subject: Re: Oracle Forms question Message-ID: <8921@portia.Stanford.EDU> Date: 7 Feb 90 08:07:20 GMT Sender: Michael Wang Reply-To: mouser@portia.Stanford.EDU (Michael Wang) Organization: Stanford University Lines: 39 In article <326@sfc.Wichita.NCR.COM> chas@sfc.Wichita.NCR.COM (Charles Binford) writes: > I have a key-nxtfld trigger on a field that sometimes updates another > display-only field. The field update should *never* happen when the > record has been queried-up (?) and is being changed (UPDATED). > If this is a new record (INSERT), then based on other criteria, > I want to modify the display-only field. > ... > My ideal solution would be to access a 'system.mode' variable that > told me if the current record was either an update or an insert. I > do not know of any such variable, however :-(. Probably the easiest way to do this is to check the rowid of the row that you are in. If the rowid is NULL, then you know that the row is being inserted, otherwise you know the row is being updated. For example you could have a KEY-NXTFLD trigger that looked something like: #EXEMACRO CASE block.rowid IS WHEN '' THEN COPY :field1 INTO :field2; NXTFLD; WHEN OTHERS THEN NXTFLD; END CASE; The COPY INTO command is a new feature in SQL*Forms 2.3. If you are using SQL*Forms 2.0, then you would have to use success/failure labels and branch to different steps. -Michael Wang +--------------+------------------------------------------------------------+ | Michael Wang | 325 Melville Avenue, Palo Alto, CA 94301 | |--------------+------------------------------------------------------------| | ARPAnet, CSNET, BITNET, Internet: mouser@portia.stanford.edu | | UUCP: ...decwrl!portia.stanford.edu!mouser | +---------------------------------------------------------------------------+