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: Subject: Generalized "link by attribute"
Topic Summary: Need to link modules based on excel spreadsheet
Created On: 11-Jul-2007 15:47
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.
 11-Jul-2007 15:47
User is offline View Users Profile Print this message


Frank Poljanec

Posts: 4
Joined: 15-Mar-2007

fficeffice" />>>

Background>>

 >>

I have an Excel spreadsheet containing many to many relationships between various documents.  It has been decided that this mapping and related documents will be the basis for their traceability in DOORS, what I would like to do is use this mapping to create the linksets.  The normal "link by attributes" would not help because it requires knowledge of the target object absolute number.>>

 >>

An example of a mapping file could be:>>

Requirement number>>

SAD section number>>

Test case number>>

Req1>>

2.4.3>>

TC12>>

Req1>>

2.4.3>>

TC13>>

Req2>>

2.4.3>>

TC12>>

Req2>>

2.4.3>>

TC13>>

Req2>>

2.4.4>>

TC14>>

...>>

...>>

...>>

 >>

Best solution I can think of:>>

1) Save the spreadsheet in CSV>>

2) Import CSV into a new "mapping" module>>

3) Have a DXL script that you can:>>

            Select source module name, attribute in source module, and source attribute in "mapping" module>>

            Select target module name, attribute in target module, and target attribute in "mapping" module>>

            Select Link Module>>

4) Run the script and all the links will be created from the source to target modules>>

5) Repeat steps 3 and 4 as needed>>

 >>

Given the example above:>>

 >>

If we wanted to map/link the "System Requirements" module to the "Software Architecture Document" module, the input screen would look like:>>

Source Module: /Phase 1/Design/Software Architecture Document>>

Source Attribute: Object Heading {attribute in "Software Architecture Document" module}>>

Source Mapping Attribute: SAD section number {attribute in mapping module}>>

 >>

Target Module: /Phase 1/Requirements/System Requirements>>

Target Attributes: Requirement ID {attribute in "System Requirements" module}>>

Target Mapping Attribute: Requirements number {attribute in mapping module}>>

 >>

Link Module: /Phase1/links/Satisfies>>

 >>

The result would create 3 links:>>

- The object with Object Heading "2.4.3" in Software Architecture Document module to the object with Requirement ID "Req1" in System Requirements>>

- The object with Object Heading "2.4.3" in Software Architecture Document module to the object with Requirement ID "Req2" in System Requirements>>

- The object with Object Heading "2.4.4" in Software Architecture Document module to the object with Requirement ID "Req2" in System Requirements>>

 >>

 >>

If anyone can think of an easier or better solution, please let me know>>

Report this to a Moderator Report this to a Moderator
 11-Jul-2007 16:36
User is offline View Users Profile Print this message


Eric Barbier

Posts: 2
Joined: 5-Jul-2007

Hi Franck, I had a similar issue the past few days. I have imported my Excel spreadsheet and then written some dxl code to generate automatically the links between a list of Hazard causes that has an attribute that contains the abs numder of the hazard on another module. I have pasted below the code. Hopefully you can tune fairly easily it to fit your need... Note: I didn't bother for now to find the hazard by an attribute different from the abs no. Should not be that difficult though... Cheers, Eric +++++++++++++++++++++++++++++++ /* * This module features the function "CreateLink" that generates automatically the links between the objects of 'FaultAnalyisModule' and 'HazardAnalysisModule'. * The function search in 'HazardAnalysisModule' for the the object which absolute number is defined in the 'Cause To' attribute of 'FaultAnalyisModule'. * If the object is found a link from the object of 'FaultAnalyisModule' to the object of 'HazardAnalysisModule' is create. If the object is not found an error * message is displayed. * * NOTE: the name of the modules 'FaultAnalyisModule' and 'HazardAnalysisModule' is hard coded and defined in the constants below. * The name of the link module that hosts the links from 'FaultAnalyisModule' to 'HazardAnalysisModule' in defined as a constant * as well as the name of the attribute that contains the absolute numbers */ #include #include #include pragma runLim,0 // no time-out on run time /******************************************************************************* * Constants * *******************************************************************************/ const string SourceModule = "Fault Analysis" const string TargetModule = "PHA" const string LinkModule = "FaultAnalysis2PHA" const string AbsNoAttr = "Cause" /******************************************************************************* * Global Variables *******************************************************************************/ string mod_name Buffer ErrorMsg = create // buffer to error message: list hazard numbers not found in the hazard list Buffer ErrorMsgTmp = create // buffer of error messages for one object of the source module bool DisplayErrorMsg = false // flag to specifies that at least one number has not been found and we must display the error message bool Add2ErrorMsg = false // flag to specifies that at least one number in the current source module object has not been found /******************************************************************************* * Name: CreateLink * Function: Look in target module object which absolute number matches 'AbsNb'. If object found creates a link from oSrc * object to the object in the target module * * Inputs: * TgtM: name of target module * oSrc: object in source module to link from * AbsNb: absolute number of the object in the target module to link to *******************************************************************************/ void CreateLink(Module TgtM, Object oSrc, int AbsNb) { Object oT // object in target module // ack "absolute number looked for in target module: " AbsNb "" oT = object(AbsNb,TgtM) // look in Target module for the object which absolute number matches 'AbsNb' if (!(null oT)){ // object found oSrc -> LinkModule -> oT } else{ // object not found ErrorMsgTmp+= AbsNb"" ", " Add2ErrorMsg = true } } /******************************************************************************* * Name: LinkSrc2Tgt * Function: link source module(SrcM: module which link starts from) objects to target module (TgtM: module which link goes to)objects) * * Inputs: * SrcM: name of the source module that contains the AbsNoAtr attribute * TgtM: name of the target module that contains the AbsNoAtr objects * LinkSrc2Tgt: name of the module that hosts the links from SrcM to TgtM * LinkAttr: name of the attribute that contains the absolute number of the target module objects *******************************************************************************/ void LinkSrc2Tgt(string SrcMname, string TgtMname, string LinkSrc2Tgt, string LinkAttr) { int AbsNumber Link Outgolink int Offset int Len, Len1, counter string s, s1 bool OneMoreNb Module SrcM, TgtM ModName_ SrcM_name,TgtM_name Object oS // object in source module // Initialize Source module reference if (null SrcMname) { ack "No source module specified" return } else{ SrcM_name = module(SrcMname) if (exists(SrcM_name)){ if (!(open(SrcM_name))){ // module is not open SrcM = edit(SrcMname,true) // open module in 'edit' mode if (null SrcM){ ack "Cannot open " SrcMname " module in EDIT(write access) mode" return } } else SrcM = module(item(SrcMname)) // initialize SrcM } else{ // module does not exist ack "module " SrcMname " does not exist" return } } // Initialize Target module reference if (null TgtMname) { ack "No target module specified" return } else{ TgtM_name = module(TgtMname) if (exists(TgtM_name)){ if (!(open(TgtM_name))){ // module is not open TgtM = edit(TgtMname,true) // open module in 'edit' mode if (null TgtM){ ack "Cannot open " TgtMname " module in EDIT(write access) mode" return } } else TgtM = module(item(TgtMname)) // initialize TgtM } else{ // module does not exist ack "module " TgtMname " does not exist" return } } // Check attribute name of source module AttrDef ad = find(SrcM,LinkAttr) if (null ad){ ack "Attribute '" LinkAttr "' does not exist in source module '" SrcMname "'" return } // Init error message ErrorMsg= "The following Hazard absolute number(s) specified in the FaultAnalysis 'Cause To' attribute have not been found in the Hazards list:\n" // first delete all links for oS in SrcM do { for Outgolink in oS -> LinkSrc2Tgt do{ delete Outgolink // mark this link to be deleted } } flushDeletions // delele all structures that have been marked as "to be deleted" // For each object of the source module, look at the "Cause To" attribute // If the attribute contains number, create links from this object to the object // in the target module which absolute number matches the attribute "Cause To" number // string = [X , Y , Z ] // offset [0 MemOffset Offset Len1-1], MemOffset points to the previous comma, Offset points to the last comma for oS in SrcM do { // scroll each object of the source module ErrorMsgTmp= "" Add2ErrorMsg = false if ((!(null oS.LinkAttr)) && (oS.LinkAttr"" != "") && (oS.LinkAttr"" != " ")){ // check if the "Cause to" attribute of the current object has a value s = oS.LinkAttr OneMoreNb = false if (findRichText(s,"\n",Offset,Len,true)){ // look for the first comma in the attribute string (if any) Len1 = length s counter = 0 while ((Offset<= Len1)&&(counter<6)) { counter++ // ack ("found number: " s[0ffset-1]) // Note: array index starts from 0 and stops at (Len-1) AbsNumber = intOf s[0ffset-1] CreateLink (TgtM,oS,AbsNumber) if (OneMoreNb) break s = s[Offset+1:Len1-1] Len1 = length s if (!findRichText(s,"\n",Offset,Len,true)){ // not found another comma, Note:findRichText returns 0 for the Offset // ack "found last number: " s[0:Len1-1] " Offset=" Offset"" " length=" Len1"" // Note double quote '""' used to cast a number into a string if (Len1>=1){ // check if there is a number between the last found comma and the end of the "attribute" string Offset = Len1; // Number stops at the end of the string OneMoreNb = true } else Offset = Len1+1; // to stop the while loop! } else // ack "found another number: " s[0ffset-1] }//end WHILE } else{ // no comma found, only one number AbsNumber = intOf s CreateLink (TgtM,oS,AbsNumber) } } // end IF if (Add2ErrorMsg){ ErrorMsg += "Number(s) " ErrorMsgTmp " for object AbsNumber=" oS."Absolute Number" " not found\n" DisplayErrorMsg = true } }// end FOR loop if (DisplayErrorMsg){ // ack stringOf ErrorMsg // display error message // Save error message in text file string DoorsCurDir = getenv("DOORSHOME") string filename = DoorsCurDir "\\lib\\dxl\\addins\\user\\" "LinkSource2TargetErr.txt" Stream out = write filename out << ErrorMsg // write error message to error file close out string command = "c:\\windows\\notepad.exe " filename system command delete ErrorMsg // clear buffer } } /******************************************************************************* * Function call *******************************************************************************/ LinkSrc2Tgt (SourceModule,TargetModule,LinkModule,AbsNoAttr)
Report this to a Moderator Report this to a Moderator
 11-Jul-2007 16:37
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Well your source and target modules should each have "key" information that "links" the two together. If you don't, you might want to consider adding it in. The relationships shouldn't be external.

But yes your idea would work. It's a fairly easy script to write. Use #include <standard/miniExplorer/inc/miniExplorer.inc> for the selecting modules part(likely a button that pops up the mini explorer and stores the path of the selected module in a string).

I just finished writing something at work extremely similar except I'm not creating links.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 11-Jul-2007 16:40
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

I guess the script provided in this thread

here

should do exactly what you want.

Peter

Edit: Modified the link according to the new forum layout

Edited: 29-Nov-2007 at 09:01 by Peter Albert
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 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 2 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.