Disable a trigger

Hi all,

I have a trigger (pretty simple) that writes a particular value into a given attribute, let's call it Attribute 1, every time that an user changes the Object Text of a requirements.

Every now and then I need to run a maintainance script that, among other operations, could update the Object Text of a requirement. When the script is executed and it updates the Object Text of the requirement, the trigger is triggered and Attribute1 is updated.

I would like to avoid this. In other words, before running the script, I would like to disable the trigger. Then I could run the script and after I should enable again the trigger.

Is there a way to achieve this or is the only solution to delete the trigger, run the script and create again the trigger?

 

Thanks

Nicola

 

 


NicolaCarusi - Tue Jul 18 22:20:41 EDT 2017

Re: Disable a trigger
PekkaMakinen - Wed Jul 19 00:46:22 EDT 2017

Start the DOORS client with a -notriggers (or -T) command line switch as a Database manager

 

-notriggers (-T) Turns off triggers. You must be either a database manager or a custom user who has the power to manage the database to turn off triggers

https://www.ibm.com/support/knowledgecenter/SSYQBZ_9.6.1/com.ibm.doors.configuring.doc/topics/c_clientcommandswitches.html

Re: Disable a trigger
NicolaCarusi - Wed Jul 19 00:52:46 EDT 2017

Hi PekkaMakinen,

 

Thanks for your answer.

Unfortunately it doesn't solve my problem for two reasons:

1. I need to maintain active all other triggers

2. The script can be executed by all users and of course not all users are database manager.

 

I am thinking to solve the problem with a variable at module level.

When the script starts it will set the variable to TRUE.

The trigger will check the variable. If it is TRUE it will halt, otherwise it will continue.

When the script ends, it will set the variable to FALSE

Re: Disable a trigger
PekkaMakinen - Wed Jul 19 01:01:09 EDT 2017

NicolaCarusi - Wed Jul 19 00:52:46 EDT 2017

Hi PekkaMakinen,

 

Thanks for your answer.

Unfortunately it doesn't solve my problem for two reasons:

1. I need to maintain active all other triggers

2. The script can be executed by all users and of course not all users are database manager.

 

I am thinking to solve the problem with a variable at module level.

When the script starts it will set the variable to TRUE.

The trigger will check the variable. If it is TRUE it will halt, otherwise it will continue.

When the script ends, it will set the variable to FALSE

OK, the module attribute trick probably works.

 

One other idea: for some of my triggers I have set up checking of DOORS user ID or group. The triggered function is then not activated for persons belonging to Admin group or if the user type is Database manager....or whatever.
 

Re: Disable a trigger
Mathias Mamsch - Wed Jul 19 04:19:25 EDT 2017

NicolaCarusi - Wed Jul 19 00:52:46 EDT 2017

Hi PekkaMakinen,

 

Thanks for your answer.

Unfortunately it doesn't solve my problem for two reasons:

1. I need to maintain active all other triggers

2. The script can be executed by all users and of course not all users are database manager.

 

I am thinking to solve the problem with a variable at module level.

When the script starts it will set the variable to TRUE.

The trigger will check the variable. If it is TRUE it will halt, otherwise it will continue.

When the script ends, it will set the variable to FALSE

To avoid writing to the module I would rather use an environment variable to check from the trigger. Especially if you run your maintenance script from batch. 

One more note: 

What you are describing sounds a bit like a process problem to me. You want to track changes to the requirement text (and maybe fill some life-cycle attributes, etc) but you don't want to track the changes that your script does. To me this sounds more or less like there are "unimportant" changes and "important" changes (the latter of which you want to track). Chances are that you users will want to be able to make "unimportant" changes (like fixing a typo). So MAYBE you want to rethink the Object Text trigger mechanics to allow unimportant changes alltogether. 

Regards, Mathias