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: Trigger repeat 'firing'
Topic Summary:
Created On: 24-Jun-2004 09:00
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.
Answer This question was answered by Dave McMahon, on Wednesday, June 30, 2004 4:22 PM

Answer:
Thanks Guys,
Sorted the problem out, now......Like a dummy I forgot that triggers remain active per DOORs sessions and not per DXL program. Each time I ran the DXL script and subsequently de-bugged it a instance of the trigger was produced. When I closed the DOORs session and re-started the DOORs application the Triggers worked just the once as advertised.
Have now added a close function to the dialog box which contains:-
Trigger t
for t in database do{
delete t
}
This makes sure that the triggers are deleted at the end of each execution.
 24-Jun-2004 09:00
User is offline View Users Profile Print this message


Dave McMahon

Posts: 22
Joined: 28-Jul-2003

Hi,
I have wirtten a small DXL program to be used when testing DXL scripts, The code was suppposed to have detected a module opening event, then issue a on screen warning and write to an alreaady opened stream.

The problem is that it appears to fire multiple times. when one module is opened. The result is the stream file contains 4 or 5 entries for the one event.

The code is included below:-

bool preModOpen(Trigger trgModuleOpen) {
mod_Name = module(Trigger trgModuleOpen)
trigType = type(Trigger trgModuleOpen)
ack ("WARNING! " mod_Name " Module is about to be opened!")
output << mod_Name "\n"
return
}
Trigger trgModuleOpen = trigger ( module -> all,open, 2, preModOpen )

Any ideas ??


Dave mc

Report this to a Moderator Report this to a Moderator
 24-Jun-2004 14:24
User is offline View Users Profile Print this message


Michael Sutherland

Posts: 248
Joined: 13-Sep-2002

Dave,

It is normal for DOORS to open other modules when a single module is opened, if that single module has a Layout DXL traceability column in it's default view.

One trick is to have your trigger code only respond to modules that are opened visible, or only opened for edit. The isVisible() and isEdit() commands can help.

-------------------------
Michael Sutherland
michael@galactic-solutions.com
http://galactic-solutions.com
Report this to a Moderator Report this to a Moderator
 24-Jun-2004 14:57
User is offline View Users Profile Print this message


Dave McMahon

Posts: 22
Joined: 28-Jul-2003

Sorry,
probably didn't make it clear, the stream output indicates that it is the same module opening multiple times , yet in re-ality the module only actualy opens once.........

Dave
Report this to a Moderator Report this to a Moderator
 29-Jun-2004 14:26
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

There are multiple output lines but only one "ack"?

You ought to declare your variables: lets not point unloaded guns. There are two "module(trigger)" commands; one returns a string and the other a Module handle. I suppose it figured out the correct one from your code.

The string = module(Trigger) command returns the module that is opening? I haven't had perfect luck with the "module = current" command inside a trigger figuring out the module that triggered the trigger, since it won't work for "pre" triggers and sometimes it grabs a just opened link module as current (the trigger fires independantly with the opening of link partners). The function should return(true).

I suspect Sutherland's comments apply: multiple modules are opened but the module(trigger) command is not what you think it is. I'd find out the name of the current module inside the trigger and output that (if not null) as well as the "module(trigger)", just to see if there is a difference.
Otherwise perhaps you've got multiple triggers deployed simultaneously.

Triggers are tricky, the commands are flaky, and the documentation is inadequate and faulty. I doubt there are any true "trigger" experts anywhere. Good luck.

- Louie
Report this to a Moderator Report this to a Moderator
 30-Jun-2004 16:22
User is offline View Users Profile Print this message


Dave McMahon

Posts: 22
Joined: 28-Jul-2003

Answer Answer
Thanks Guys,
Sorted the problem out, now......Like a dummy I forgot that triggers remain active per DOORs sessions and not per DXL program. Each time I ran the DXL script and subsequently de-bugged it a instance of the trigger was produced. When I closed the DOORs session and re-started the DOORs application the Triggers worked just the once as advertised.
Have now added a close function to the dialog box which contains:-
Trigger t
for t in database do{
delete t
}
This makes sure that the triggers are deleted at the end of each execution.
Report this to a Moderator Report this to a Moderator
 1-Jul-2004 16:09
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Your delete loop is prone to errors. For one thing if you define a "module-all" trigger while a project is open, I believe its stored in the Project and NOT in the DB. User "project->all->module-all" to insure its in the DB. For another you'll delete other folks triggers, who may have defined a persistent one. Perhaps you want to add some sort of "is it dynamic" test before deleting it.

- Louie
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 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 0 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.