Previous Topic: Insert a Macro into a Template Code Window

Next Topic: View Trigger Template Macro Code

Examples of Trigger Code

Some of the commonly used trigger code is shown below:

%JoinFKPK(<child table>,<parent table>) 

Syntax

%JoinFKPK(<child table>,<parent table>)

Syntax Example

%JoinFKPK(%Child,deleted)

Expansion

MOVIE_RENTAL_RECORD.master_number = deleted.master_number and
MOVIE_RENTAL_RECORD.movie_copy_number = deleted.movie_copy_number

Full Syntax

%JoinFKPK(<child table>,<parent table>,<comparison op>,<separator>)

Full Syntax Example

%JoinFKPK(%Child,deleted," <> "," or")

Expansion

MOVIE_RENTAL_RECORD.master_number <> deleted.master_number or
MOVIE_RENTAL_RECORD.movie_copy_number <> deleted.movie_copy_number

%NotnullFK(<child table>,<not null expression>)

Syntax

%NotnullFK(<child table>,<not null expression>)

Syntax Example

%NotnullFK(%Child,"is not null and")

Expansion

MOVIE_RENTAL_RECORD.master_number is not null and
MOVIE_RENTAL_RECORD.movie_copy_number is not null and…

Full Syntax

%NotnullFK(<child table>,<not null expression>,<prefix>,<separator>)

Full Syntax Example

%NotnullFK(inserted,"is null","where"," or")

Expansion

where
  inserted.master_number is null or

inserted.movie_copy_number is null