![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Automating link by attribute in a group of modules Topic Summary: Automating link by attribute in a group of modules Created On: 26-Jul-2006 19:02 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I have been directed to do link-by-attribute instead of the typical linking, and I am looking for a way to automate linking by attribute in a large group of modules (30 or so). Each module has an attribute called OutLinks holding the links to a particular higher-level module. I was hoping to automate it and have a batch job that makes the links at night on all 30 modules, but it seems to be a tricky task.
Does anyone have advice on how to do this or a DXL script that has done this? I wish I could just automate the GUI to call the link by attribute command, fill in the fields, and do the linking. Jason Lutz |
|
![]() |
|
![]() |
|
This scheme of having users specify the Identifier of their desired target object and having a script acually create the links is a great idea. Besides the mundane advantages you can then easily restore a module from backup without losing any links.
I cannot send the script that I have, partly because its someone elses proprietary, but also I need to write a new one anyway and need to clarify the steps in my mind by pretending to be doing this just for you, thusly: [] You will want the script to delete links that are no longer needed. You could simply find and delete all such links before creating any, but to support Suspect Links you should only delete links that are no longer needed, and only create links that don't yet exist. [] You need to know for sure the name of the desired target module. You could realistically have your Outlinks attribute be a module-and-object level string-or-text attribute, and the full path of the desired target module is inserted into the module part (via module properties). [] Open the target. Store each of the targets undeleted objects into a skpTargetObjects whose 'Key' is the Absolute Number and Data is the "Object" [] For each oSource source object,: <1> Put all the existing links to your target into a skpExistingLinks, Key is AbsNo Data is the "Link" (note: not all links, just those to this target module). <2> Read the attr value, and find each individual target AbsNo (you need to enforce a standard delimitor like a space or comma-space) and store them into a skpDesiredLinks list. <3> For each desired target AbsNo in skpDesiredLinks: if that AbsNo is in the skpExistingLinks then delete it from skpExistingLinks. If its not in skpExistingLinks then search for that AbsNo in skpTarget5Objects; if found create the link otherwise print the "no such undeleted target object" error. <4> When done with all the desired links, for each link that's still in skpExistingLinks, delete the link (its no longer needed, or the target is now deleted). flushDeletions. Then go to the next source object. [] If the source object is deleted then delete all its outgoing links. Deleting a link while inside some "for link" loop will cause problems, so first stage the links in a Skip list, then loop throught the skip deleting the links; then of course flushDeletions. I would insert this code into the above code such that if isDeleted(oSource) then don't process any skpDesiredLinks (steps <2> and <3> above); just go to the part where you delete the links still in skpExistingLinks (step [4]). [] Don't forget to save the source module. If this single attribute can demand links to more than one module then you need to have a project policy that allows you to determine the exact module given a object Identifier; this usually means your module names must be very short, unique within the project, and Module prefixes should match the names exactly, with a trailing "_". - Louie |
|
![]() |
|
![]() |
|
A simple solution to the multiple target modules is to have one object level attribute per target. You can then create the attribute name from the target module full name, and hey presto, you've lost the need for the module attribute.
------------------------- Paul dot Tiplady at TRW dot com TRW Automotive |
|
![]() |
|
![]() |
|
quote: You can do this with the excellent autohotkey tool (it's freeware). Its probably not the best way to achieve your aims, but it is a great way of using tools where you can't steal the code because its encrypted. Have fun! AutoHotKey An example script for DOORS that controls the "edit->attributes" dialog (bit silly, but it may help get you started) ------------------------- Regards, Richard Good Edited: 27-Jul-2006 at 20:03 by Richard Good |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.