Subject Re: [IBO] Calculating data
Author Marcin Bury
Terry

Contact me privately at marcin.bury at studio-delfi.pl
And send me definition of these two tables...

Marcin

W dniu 08.09.2014 16:03, tblac@... [IBObjects] pisze:
>
>
> Hi Marcin, If I have 2 fields to update, is it better to have one larger
> Trigger or 2 smaller ones.
> Secondly I have to update a single table field called "Quotahours". This
> field is the product of FTE2 * 690
>
> Below is my code but is doesn't work.
>
> SET TERM ^ ;
> CREATE TRIGGER QUOTA FOR STAFF ACTIVE
> AFTER INSERT OR UPDATE OR DELETE POSITION 1
> AS
> DECLARE VARIABLE STAFF_CODE INTEGER;
>
>
> BEGIN
> IF (INSERTING OR DELETING OR (UPDATING AND (NEW.QUOTAHOURS IS
> DISTINCT FROM OLD.QUOTAHOURS)))
> THEN BEGIN
> IF (DELETING)THEN STAFF_CODE = OLD.STAFF_CODE;
> ELSE STAFF_CODE = NEW.STAFF_CODE;
> UPDATE STAFF
> SET QUOTAHOURS = (690 * FTE2)
> WHERE STAFF_CODE = :STAFF_CODE;
> END
>
> END^
> SET TERM ; ^
>
> Can you see why my code doesn't work?
>
> Terry
>
>
>
>