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: 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
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.
 26-Jul-2006 19:02
User is offline View Users Profile Print this message


Jason Lutz

Posts: 13
Joined: 14-Jul-2005

     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
Report this to a Moderator Report this to a Moderator
 27-Jul-2006 16:01
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

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
Report this to a Moderator Report this to a Moderator
 27-Jul-2006 16:13
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

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
Report this to a Moderator Report this to a Moderator
 27-Jul-2006 19:08
User is offline View Users Profile Print this message


Richard Good

Posts: 152
Joined: 22-Mar-2005

quote:

I wish I could just automate the GUI to call the link by attribute command, fill in the fields, and do the linking.


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
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.