Question
Luiz Henrique C... · Jul 24, 2020

Examples of trigger

 

Hello people!

I am Brazilian and I am starting to work with the latest version of CACHE, and I would like to know where I can see an example of a TRIGGER, I would like to validate the fields before writing the actual data in the database.

in advance, thank you very much! and sorry for any mistake in concordance in english

00
4 0 7 161
Log in or sign up to continue

Replies

Hi @Luiz Henrique Carvalho Martarelli 

You can take a look at this post: Trigger or Callback?
https://community.intersystems.com/post/trigger-or-callback

And for more detail information: Using Triggers
https://cedocs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GSQL_triggers 

If you have interested, the Developer Community has a Discord with a dedicated Channel for Portuguese Speakers. laugh 
https://discord.gg/dzzPDvY

Best Regards,
Henrique

Unless things have changed with IRIS I generally prefer to use triggers over any of the object implementations.  Properly defined triggers will be executed whether you are doing an object Save or a SQL INSERT/UPDATE/DELETE.  You may only want to perform the code during object save but I find why not implement the code in a trigger where you know it will always be executed.  Additionally triggers provider  

{ColumnName*N}

{ColumnName*O}

syntax which is valuable.