Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: How do I create a trigger?
Topic Summary: How to createa trigger from the beginning
Created On: 6-Dec-2007 23:38
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 6-Dec-2007 23:38
User is offline View Users Profile Print this message


Kevin Dunbar

Posts: 2
Joined: 26-Oct-2006

I would like to create a trigger that will force certain users to open a specific module in shareable-edit mode only. I know that I should create a trigger to do this but I have no idea how to create a trigger. The dxl reference manual has code but it doesn't tell me where to put this code. Do I open up the module and go to Module Properties or something and put it there? I looked through all the manuals and there was nothing on where to put trigger code.

Any advice would be greatly appreciated.

Thanks,

Kevin
Report this to a Moderator Report this to a Moderator
 7-Dec-2007 08:32
User is offline View Users Profile Print this message


Andrew Tagg

Posts: 151
Joined: 26-Oct-2004

hmm, I have this somewhere. Will post it on monday if no one else does it first.

-------------------------
Andrew Tagg
Thales Air Systems, Melbourne
Australia.
andrew.tagg@thalesatm.com
Report this to a Moderator Report this to a Moderator
 7-Dec-2007 17:28
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

There is no GUI method of dealing with Triggers, you must use DXL to deploy and to delete Triggers. That means you [1] create the code of the trigger itself [2] create another DXL whose job it is to deploy the trigger. This deploy code should also provide a mechanism for deleting the trigger. Presumably the Deploy trigger need only exist on your client, since you only need it to deploy and delete, you don't need it during the life of the trigger.

[1] Create the Trigger code. You have several options here. [1a] put the code in a separate file and #include it in the trigger. I dislike this alot since the #include file would need to be available to all users of the module, meaning the network location you put it must be readable by all users. [1b] put the code in a separate file and user 'readFile' to get it into the deploy code. This is a great option for complicated Triggers, but has the disadvantage that you have 2 files to maintain for the trigger (Deploy dxl and the Trigger dxl). [1c] code the trigger inside the 'trigger(...)' command. This makes your deploy code hopelessly confusing [1d] define a string variable that has the DXL code in it; and the 'trigger(...)' command uses that variable. This is the option I use most often.

[2] Create the Deploy code. This code should look something like this:
string TriggerDXL = [1b] readFile(NameOfFile); or [1d] "bla bla bla trigger code"
string TriggerName = "NameOfTrigger"
if ("Remove Trigger '" TriggerName "'??) delete(TriggerName, module, post, open, 10)
if ("Deploy Trigger '" TriggerName "'??")
{ Trigger trg = trigger(TriggerName, module, post, open, 10, TriggerDXL)
if (null trg) infoBox(TriggerName " didn't seem to get deployed")
}

If you change the parameters of the trigger, be sure to delete the trigger before changing the deploy code; otherwise the 'delete' command won't find the trigger.

I didn't try the attached code, but it should get you started; presuming you intend to deploy this trigger in a particular module. In the 'DxlTrig' variable, take notice that double quote and slash characters need to be 'escaped' by prefix with a slash. Run the attached for each Edited module you want the trigger to run.

This particular trigger is particularly tricky, since you must have the module open Edit in order to deploy or remove the trigger, but the trigger disallows Edit. Thus, the Trigger itself should provide a mechanism for opening Edit. In this case I've chosen the Administrator, folks with module RMCDA access, or DB Managers.

Please post the code after you've fixed it.

- Louie
Report this to a Moderator Report this to a Moderator
 10-Dec-2007 21:57
User is offline View Users Profile Print this message


Kevin Dunbar

Posts: 2
Joined: 26-Oct-2006

Louie,

Thank you so much for all the time and effort you put into explaining this to me. I found it to be very well thought out and it seems like it will be very helpful. I haven't tried it out yet but I will today. Thank you so much again. I didn't expect much help from this forum but you definitely proved me wrong. I will post the code when it is finished.

Sincerely,

Kevin
Report this to a Moderator Report this to a Moderator
 17-Jan-2008 15:34
User is offline View Users Profile Print this message


Dominic Butler

Posts: 3
Joined: 12-Feb-2007

Hi Louie,

I thought I'd let you know that I've found this useful as well. I was at a loss when trying to create a trigger, so thanks for your post.

Dominic
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.