Schema : where is the table trigger "Check CRC" as

Posted by slacroixak on 11-Jun-2019 13:11

Can anyone point me to the magical field of the _File_Trig table that would eventually hold the value of the "Check CRC" toggle-box shown in the Data Dictionary/Table/Triggers view ?

So far, the only existing logical field seems to care of the Overridable aspect

Posted by Laura Stern on 11-Jun-2019 15:37

Or of course you could have used the OF construct :-):

FOR EACH _file NO-LOCK WHERE _file._Hidden = FALSE

 ,EACH _File-Trig OF _File NO-LOCK

  WHERE _File-Trig._Trig-Crc <> 0 AND _File-Trig._Trig-Crc <> ?

  BY _file._File-Name:

Posted by Patrice Perrot on 11-Jun-2019 15:24

Hi Sebastein,

I think you missed    " AND  _File-Trig._File-Recid = RECID (_File) "

You do not take care of the table for the trigger

Regards

Patrice

FOR EACH _file NO-LOCK WHERE _file._Hidden = FALSE

  ,EACH _File-Trig NO-LOCK WHERE _File-Trig._Trig-Crc <> 0 AND _File-Trig._Trig-Crc <> ?

   AND  _File-Trig._File-Recid = RECID (_File)   /*<============= */

  BY _file._File-Name:

   DISPLAY

       _file._File-Name

       _File-Trig._Event

       _File-Trig._Proc-Name

       _File-Trig._Override

       _File-Trig._Trig-Crc

       WITH WIDTH 120.

END.

All Replies

Posted by gdb390 on 11-Jun-2019 13:17

the _field-tri._trig-crc is the field you search

/* extract from the code */

(IF _Field-trig._Trig-Crc <> 0 AND _Field-trig._Trig-Crc <> ?

                 THEN yes ELSE no) @ check_crc

Posted by gdb390 on 11-Jun-2019 13:17

the _field-tri._trig-crc is the field you search

/* extract from the code */

(IF _Field-trig._Trig-Crc <> 0 AND _Field-trig._Trig-Crc <> ?

                 THEN yes ELSE no) @ check_crc

Posted by slacroixak on 11-Jun-2019 13:52

My question was about triggers defined for a table in _File-trig, like CREATE WRITE or DELETE, not for Field triggers (ASSIGN) in _Field-Trig

I just tried to query _file and _File-Trig this way, but the result includes table triggers that have the "Check CRC" option disabled.  I mean, the value of _File-Trig._Trig-Crc is not 0 nor unknown:

CURRENT-WINDOW:WIDTH-CHARS = 120.

FOR EACH _file NO-LOCK WHERE _file._Hidden = FALSE

   ,EACH _File-Trig NO-LOCK WHERE _File-Trig._Trig-Crc <> 0 AND _File-Trig._Trig-Crc <> ?

   BY _file._File-Name:

    DISPLAY

        _file._File-Name

        _File-Trig._Event

        _File-Trig._Proc-Name

        _File-Trig._Override

        _File-Trig._Trig-Crc

        WITH WIDTH 120.

END.

So this might be handled differently.  Did I miss something?

Posted by Stefan Drissen on 11-Jun-2019 14:05

see prodict/user/user-f.i

crc[i]     = (if wfit._Trig-CRC = ? then no else yes)

and

           wfit._Trig-CRC = (IF INPUT FRAME frame-f crc[i]

      THEN new_crc_val[i] ELSE ?).

Posted by Patrice Perrot on 11-Jun-2019 15:24

Hi Sebastein,

I think you missed    " AND  _File-Trig._File-Recid = RECID (_File) "

You do not take care of the table for the trigger

Regards

Patrice

FOR EACH _file NO-LOCK WHERE _file._Hidden = FALSE

  ,EACH _File-Trig NO-LOCK WHERE _File-Trig._Trig-Crc <> 0 AND _File-Trig._Trig-Crc <> ?

   AND  _File-Trig._File-Recid = RECID (_File)   /*<============= */

  BY _file._File-Name:

   DISPLAY

       _file._File-Name

       _File-Trig._Event

       _File-Trig._Proc-Name

       _File-Trig._Override

       _File-Trig._Trig-Crc

       WITH WIDTH 120.

END.

Posted by Laura Stern on 11-Jun-2019 15:37

Or of course you could have used the OF construct :-):

FOR EACH _file NO-LOCK WHERE _file._Hidden = FALSE

 ,EACH _File-Trig OF _File NO-LOCK

  WHERE _File-Trig._Trig-Crc <> 0 AND _File-Trig._Trig-Crc <> ?

  BY _file._File-Name:

Posted by slacroixak on 12-Jun-2019 12:57

Damned, indeed, I was using the OF operator in my initial piece of code, and I managed to drop it.  This might explain that

Posted by slacroixak on 12-Jun-2019 13:05

For the records, this code lists the table triggers with Check-CRC enabled:

CURRENT-WINDOW:WIDTH-CHARS = 120.

FOR EACH _file NO-LOCK WHERE _file._Hidden = FALSE

   ,EACH _File-Trig NO-LOCK OF _file

   WHERE _File-Trig._Trig-Crc <> 0 AND _File-Trig._Trig-Crc <> ?

   BY _file._File-Name:

   DISPLAY

       _file._File-Name

       _File-Trig._Event

       _File-Trig._Proc-Name

       _File-Trig._Override

       _File-Trig._Trig-Crc

       WITH WIDTH 120.

END.

This thread is closed