Re: Need trigger for form.

From: Aaron V <Tinkerist_at_hotmail.com>
Date: Sun, 23 Nov 2003 00:40:22 GMT
Message-ID: <WlTvb.281308$Fm2.291031_at_attbi_s04>


I think your confusing the front end and back end procedures. Your Database Procedures
won't immediately update the information that you display in your form even if you call it
from the form. If you want to use that cancel procedure try something like this

your button I presume is in the block we're referring to... WHEN-BUTTON-PRESSED trigger

DECLARE
    p_id your_type := :it_gdaps_mc.p_id;     cur_rec NUMBER := :SYSTEM.CURSOR_RECORD; BEGIN
    CLEAR_BLOCK;
    cancel(p_id);
    EXECUTE_QUERY;
    GO_RECORD(cur_rec);
END; Or you Transfer you procedure to the Button trigger, you will get confermation and
more commit control this way. This would probably be the better way to go.

"M Hamilton" <mhamilton_at_usgs.gov> wrote in message news:7ce65461.0311211514.682d1a5e_at_posting.google.com...
> Tiago Rocha <tiagocrspamtalho_at_terra.com.br> wrote in message
news:<jnlsrv0mo8i5ck6qvbg2p4rngtp8nri7e6_at_4ax.com>...
> > On 20 Nov 2003 13:48:48 -0800, mhamilton_at_usgs.gov (M Hamilton) wrote:
> >
> > >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;
> >
> > hi. I'm a long time lurker on this group and will step out of the
> > shadows and try to answer...
> >
> > You have a update statement on the button when-button-pressed code? Is
> > the block a base-table block?
> >
> > if the block is base table and the field is a base table item, you
> > don't need to perform a manual update. Just assign the value to the
> > field, on the "when-button-pressed" trigger, just type the following
> > code:
> >
> > :it_gdaps_mc.status_code := 'Disabled' ;
> >
> > if you need auto-commit, issue a "commit" right after that line above.
> > You may want change the system message level to avoid messages...
> >
> > >It did not requery the database and display the new values.
> >
> > the built in "execute-query" is what you want to requery...
> >
> > >Thanks in advance,
> > >MH
> >
> > hth.
>
> Thank you Tiago for stepping 'out of the shadows'.
> Yes, it is a base table and the field is a base table item. I tried
> adding this code to the "when-button-pressed" trigger. Something
> similar to yours, but I need it to be the STATUS_CODE value set by the
> procedure.
>
> :it_gdaps_mc.status_code := items_gdaps.status_code;
>
> It did not like it. I got the error:
> ERROR 357
> Table, View, or Sequence reference 'ITEMS_GDAPS.STATUS_CODE' not
> allowed in this context.
>
> Do you have any thoughts about this?
> Thanks,
> MH
Received on Sun Nov 23 2003 - 01:40:22 CET

Original text of this message