Re: FORMS4.5: Editing two records at the same time
Date: 1997/07/29
Message-ID: <33DE5385.E77A7094_at_labatt.com>#1/1
Hans Kandlbauer wrote:
> Hi, out there!
>
> This is my (simplified) problem:
>
> I have a block with the following database fields: SomeID (NUMBER),
> Amount (NUMBER). Initially there is only one record in the table.
> Sometimes the user presses a button and adds a record at the end of
> the list. The SomeID field is initialized to a unique value and the
> Amount field is set to 0. Then the user navigates to the Amount field
> and enters a value. When he leaves this field, the new value must be
> subtracted from the Amount field in the record above, so that the sum
> of all Amount fields remains constant.
>
> And the problem is: How can I reach the previous record? I want to use
>
> the POST_CHANGE trigger, but I can't use a previous_record because it
>
> is a restricted procedure.
>
> Any ideas?
>
> -hans-
Probably the easiest thing to do is place the value of the previous records amount field in a global variable. I suggest you use the POST-RECORD trigger which fires whenever the operator or the application moves the input focus from one record to another. Your trigger should look something like this:
:global.Amount := TO_CHAR(Amount);
Then in your POST-CHANGE trigger you can do:
Default_Value('0','global.Amount');
:Amount := Amount - TO_NUMBER(global.Amount);
Let me know if you have any questions. Received on Tue Jul 29 1997 - 00:00:00 CEST