![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Trigger Trouble Topic Summary: Created On: 15-Sep-2004 13:27 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: The first Trigger changes the current-settings, so current is not what the second trigger expects when it starts. To avoid this trouble I use: Trigger trg = current() Object o = object(trg) Module m = module(o) | |
![]() |
|
I have the modules Requirements, Testdef and Test. In Requirements-module there is a Trigger defined, updating the Status of linked objects in the Testdefmodul when a Requirementsstatus changes. Also there is a Trigger in the Testdef-module updating linked objects in the Testmodule if a Testdefinitionobject is modified.
Actually both trigger do their job, except the situation that I change a req. so that the "Requirements status has changed" trigger adapts the status of linked Testdefinitions. But if the "Testdefinition status has changed" trigger starts, it changes the status of Testobjekts not linked to modified Testdefinitions and the right Objects are untouched. I supposed that's a problem with the triggerpriority, but I was wrong. Requirements Trigger: /********************************************************************************** Trigger t = trigger ("Requirements status has changed", module->"SRS"->attribute->"status", post, modify, 27, "#include </addins/scripte/trigger/reqstatus.dxl>") */ Object o = current Object Object osrc = null Module m = current Module msrc = null Link lnk = null bool op = false bool nolnk = false string status = "" string src = "" if (!open module "Testdef") { op = true } msrc = edit("Testdef", true) for lnk in o <- "*" do { src = source(lnk) if (src=="Testdef) { nolnk = true osrc = source(lnk) osrc."status" = "to clarify" } } if (!nolnk) { //create Object in module Testdef and link it to the current object } if(op) { save msrc close msrc } refresh m Testdefinition Trigger: /********************************************************************************** Trigger t = trigger ("Testdefinition status has changed", module->"Testdef"->attribute->"status", post, modify, 30, "#include </addins/scripte/trigger/Testdefstatus.dxl>") */ Object o = current Object Object osrc = null Module m = current Module Module msrc = null Link lnk = null string status = o."status" bool op = false Link getLink(string src, Object o) { Link tmplnk = null Link lnk = null string tmpsrc = "" for tmplnk in o <- "*" do { tmpsrc = source(tmplnk) if ( tmpsrc == src) { lnk = tmplnk } } return lnk } if (!open module "Test") { op = true } msrc = edit("Test", true) lnk = getLink("Test", o) //there can be only one link if (lnk==null && status=="accepted") { //create new Object in Test-Module and link it to o } else if (lnk!=null) { osrc = source(lnk) osrc."status" = "not tested" } if (op) { save msrc close msrc } refresh m ------------------------- Frank |
|
![]() |
|
![]() |
|
I'm having trouble following all this, but have the following observations:
[0] Your forum "reply" window has an "Attach Code" button. That keeps the leading white-space in tact making these scripts MUCH easier to read; rather than copying the code straight into the window. [1] "status" is a built in function, and so makes for a lousy variable name. Eventually this sort of naming WILL byte you in the bytt. Change it to "Status". [2] These link functions deal with module BASE names (e.g. "Test"), rather than module full names (e.g. "/MyProject/MyFolder/Test"). This only works if the module's in question are ALL in the same folder and that folder is current. When dealing with links, its better to get the ModName_ source and then get the fullName of that; this allows you to deal with linked partners in other folders. [3] Do your triggers work correctly when you modify the triggered attibutes with DXL? That is, instead of just testing the trigger by modifying with keyboard and mouse, run a simple DXL that modifies it: (current Object)."status" = "New Value". Its possible the "post modify" doesn't actually trigger from DXL. - Louie |
|
![]() |
|
![]() |
|
The first Trigger changes the current-settings, so current is not what the second trigger expects when it starts. To avoid this trouble I use:
Trigger trg = current() Object o = object(trg) Module m = module(o) ------------------------- Frank |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Trigger Trouble
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.