Re: Need trigger for form.

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Fri, 21 Nov 2003 16:37:34 -0800
Message-ID: <1069461480.323384_at_yasure>


M Hamilton wrote:

> Daniel Morgan <damorgan_at_x.washington.edu> wrote in message news:<1069438133.846471@yasure>...
>

>>M Hamilton wrote:
>>
>>>Come on now, someone out there knows how to do this. I just know it. 
>>>There's got to be a Forms expert that can help me out.
>>>
>>>How about Daniel Morgan?  He seems to know alot and participates in
>>>this forum a bunch with innovative solutions.
>>>
>>>Help, pleezz.
>>>MH
>>
>>Didn't notice your original post and can't get it back ... please repost.

>
>
> You bet, be glad to.
>
> In Designer6i I have created a form that has an action item (button)
> that when pressed calls the CANCEL procedure. The CANCEL procedure
> changes the value of a database column (STATUS_CODE) from 'AUTHORIZED'
> to 'CANCELED'. What trigger can I use at the block level that will
> update the block on the form and display the new value in the field?
>
> I tried using POST-UPDATE with this code:
> BEGIN
> select status_code
> into :it_gdaps_mc.status_code
> from items_gdaps
> where rowid = :it_gdaps_mc.rowid;
> END;
>
> It did not requery the database and display the new values that were
> set by the CANCEL procedure.
>
> This is the code for my procedure:
>
> CREATE OR REPLACE PROCEDURE cancel
> (p_id IN planning_groups.id%type)
> IS
> BEGIN
>
> UPDATE items_gdaps
> SET
> items_gdaps.status_code = 'CANCELED'
> WHERE
> items_gdaps.pg_id = p_id
> AND items_gdaps.status_code = 'AUTHORIZED';
>
> COMMIT;
>
> EXCEPTION
> WHEN NO_DATA_FOUND THEN
> RAISE_APPLICATION_ERROR
> (-20201, 'No data was found.');
>
> END cancel;
> /
>
> Thank you for taking a look at this.
> MH

The WHEN-BUTTON-PRESSED trigger on the Action Item button can do it ... or the procedure can do it ... but in either case any other trigger is the wrong answer.

I think someone else gave you this advice too but I'll repeat it:

<block_name>.<item_name> := <value>;

So

MyBlock.MyItem := 'Canceled';

HTH

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Sat Nov 22 2003 - 01:37:34 CET

Original text of this message