![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Trigger Topic Summary: Trigger on a module open event Created On: 15-Mar-2007 20:41 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Hi Louie, Don't want to be the wisenheimer, but I've added some comments to your statements ![]() quote: Not yet the module handle, but the name of module to be opened with function string module(Trigger) I would suggest to never use current module handle within trigger code, because it may not give you everytime the module you want to process! It may work for module open triggers (not sure if it really does in any circumstances ![]() quote: That's not correct. The function will return the current version of module that fires the trigger or if not available null. To get the storage point of trigger you may use string stored(Trigger) BTW: To get the (baselined) version of triggering module you need to add a second paramter to module function: Module module (Trigger, int) This second parameter should be 0, as described in DXL reference manual. quote: Good idea! quote: Really good hint. Would suggest to check for correct module version sometimes to. quote: Greetings Reik | |
![]() |
|
Hi
I am trying to deploy a trigger , when the user tries to open a module by clicking on it or through a Link but the catch is i need to get the name of the module which he is trying to open..i.e the module on which the trigger is activated.. i tried the following code Trigger t = trigger("init", project->all->module->formal->all , post,open, 10,"#include <C:\test.dxl>") but iam unable to get the Module name in the test.dxl program is there a way to do this.. Regards Tarun |
|
![]() |
|
![]() |
|
How about using:
Module m = module(t) Where t is the trigger? ------------------------- Shawn Stepper shawn.e.stepper@wellsfargo.com |
|
![]() |
|
![]() |
|
i tried to do that but the program does not recognise t anymore
it gives me undeclared trigger error |
|
![]() |
|
![]() |
|
Try
Module m = module(current Trigger) ------------------------- Tony Goodman http://www.smartdxl.com |
|
![]() |
|
![]() |
|
This is a pre operation trigger so it is giving the previous module still..
|
|
![]() |
|
![]() |
|
In your original post, it is a post-open trigger.
Don't forget that the trigger will fire for modules opened (not visible) by doors as a result of layout DXL etc. Have you checked this? ------------------------- Tony Goodman http://www.smartdxl.com Edited: 20-Mar-2007 at 08:46 by Tony Goodman |
|
![]() |
|
![]() |
|
Yes, i did check the pre
Trigger t = trigger("init", project->all->module->formal->all , pre,open, 10,"#include <C:\test.dxl>") but i still face the same problem. Is there any other type of trigger i can use to solve this problem.. |
|
![]() |
|
![]() |
|
Hi Tarun,
it should work to use the function string module (Trigger) It will return the name (not fullName) of module which fires the trigger. So your example code could be: Trigger t = trigger("init", project->all->module->formal->all , pre, open, 10,"print (string module (current Trigger))"); BTW: I would suggest to not use include statements within trigger code (for development it might be usefull), because this can cause errors on user machines wich have not installed the include file. Remember the trigger is active in database for all users from all clients! Greetings Reik ------------------------- Evosoft GmbH for Siemens Industry Sector Berlin, Germany |
|
![]() |
|
![]() |
|
Have read the thread. I haven't tested recently, but this is what I recall:
[] I don't think you can get the 'Module' handle of a module that's not yet open; which will happen for PRE module open triggers. POST open module triggers work OK; Module mCurr = current should do it. [] The 'module' of a trigger, IIRC, is the module that houses the trigger and not the one being fired. In your case you've put the trigger in the database and its not stored in a module. [] Your include statement will only work if EVERYONE has Test.dxl loaded in the root of their C drive. Since its probably only on YOUR C drive, your code that sets the trigger should probably read the file into a variable and put the variable in the trigger call. string TriggerCode = readFile("c:/Test.dxl"). [] Your trigger code probably wants a check for Visible and link module status; if (isVisible(mCurr)) halt; if (type(module(fullName(mCurr))) != "Formal") halt. - Louie |
|
![]() |
|
![]() |
|
Hi Louie,
Don't want to be the wisenheimer, but I've added some comments to your statements ![]() quote: Not yet the module handle, but the name of module to be opened with function string module(Trigger) I would suggest to never use current module handle within trigger code, because it may not give you everytime the module you want to process! It may work for module open triggers (not sure if it really does in any circumstances ![]() quote: That's not correct. The function will return the current version of module that fires the trigger or if not available null. To get the storage point of trigger you may use string stored(Trigger) BTW: To get the (baselined) version of triggering module you need to add a second paramter to module function: Module module (Trigger, int) This second parameter should be 0, as described in DXL reference manual. quote: Good idea! quote: Really good hint. Would suggest to check for correct module version sometimes to. quote: Greetings Reik ------------------------- Evosoft GmbH for Siemens Industry Sector Berlin, Germany |
|
![]() |
|
![]() |
|
[1] You've found a case that inside a trigger that requires an open module (post-open, pre-close, object, attr), that mod = current doesn't correctly return the module under consideration by the trigger? In normal DXL operation, I've NEVER had a problem with mod = current() to figure out the context of the DXL (although I have had some problem after the DXL is runing and has been opening modules...).
[2] I think I see the difference. I've written two scripts, one that reports triggers and one that finds them and offers to delete them. Both scripts have various "for trigger in whatever do" loops. Notice the triggers themselves are NOT firing. For such "Trigger" handles, the module(trg) function(s) return where its stored; usually null since such module-open triggers are generally in the Project or the Database. That's different from your experience that no doubt deals with 'Triggers' only once they are fired, Trig = current; Module = module(Trig); in which case the documentation and your observations are correct; module(trig) returns the module that's fired by the Trigger even when its stored elsewhere. I do recall the nightmare I had figuring out how all this Trigger stuff works, when we were using v5.2. I specifically recall banging my head against the wall writing the library function that determines where a trigger is stored, the 'stored' command returning only an unqualified string; as did the string module(trg) command. Anyway, its all hopelessly complicated. I did finally finish a "Report all the triggers in the database' script as well as the generic 'Find then offer to delete" triggers script, although the info they dumped was sometimes incomplete. Hard to believe Telelogic still had no GUI for Triggers. I've been thinking about creating one; allowing folks to define and deploy as well as search and delete. What we really need is a mechanism in DXL to turn firing of triggers on and off, perhaps available only to admins. Relying on the command line switch -T isn't adequate. - Louie |
|
![]() |
|
![]() |
|
Hi Louie,
quote: Yes, I remember there was a problem in past, but I do not remember what caused it. May be in combination of different triggers, ADXL and LDXL which will open some more modules ... quote: I think you are right. There is a difference between usage of these functions inside and outside the running trigger. quote: Here are some bloody spots on the wall too ![]() quote: You are sooo right ... Really hard to find are errors which are not reported -> Try to create a module save trigger, no error, but does the same as winword.exe /u ![]() quote: That would be very usefull. The only ways you have now is to use some global variables or revove and insert the trigger ![]() Do you really think that Telelogic will implement it - hope springs eternal ![]() Greetings Reik ------------------------- Evosoft GmbH for Siemens Industry Sector Berlin, Germany |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Trigger
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.