Re: Need trigger for form.

From: M Hamilton <mhamilton_at_usgs.gov>
Date: 21 Nov 2003 15:14:16 -0800
Message-ID: <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 Sat Nov 22 2003 - 00:14:16 CET

Original text of this message