Delete Inlinks from Target Object

Is there a simple way to delete inlinks to an object? I've crafted several variations of scripts based on the DXL Help files in DOORS, but none of them seem to work. Why doesn't the following script work?

Object o = current
ModName_ srcModRef
for srcModRef in o<-"*" do
{
read(fullName(srcModRef), false)
for inLink in o<-"*" do
{
void delete (inLink)
} //end for inLink do loop
}//end for srcModRef do loop
ChrisAnnal - Wed Jun 17 16:36:54 EDT 2009

Re: Delete Inlinks from Target Object
llandale - Wed Jun 17 17:38:15 EDT 2009

You should open all the SourceRef modules, then start another loop through the Links. Not sure what will happen with your link loop inside the Ref loop.

You'll need to open the other module Edit, or Shared and lock sections. You'll also have to save the source module(s) when you are done.

You don't want to 'void delete(inLink)', you'll want to 'delete(inLink)'. You will also probably want to surround that kind of code with noError() and string ErrMess = lastError(), and see if it worked.

You don't want to delete the main loop variable inside ANY of the DOORS native "for x in y do" loops. In this case you will corrupt the link loop if you delete a link. Instead, loop through the links and store them in a Skip list, THEN loop through the Skip list deleting the links.

You probably want to check the link to see if its one you really want to delete. 'module(inLink)' comes to mind.

Yup, Yuuuuck.

  • Louie

Re: Delete Inlinks from Target Object
ChrisAnnal - Thu Jun 18 10:05:02 EDT 2009

Thanks Louie, but I'm already sure of the inlinks I want to delete. I modified an Analysis Wizard script to display the module names of modules that are contained in a given folder, as follows:
// DXL generated by DOORS traceability wizard on 29 May 2009.
// Wizard version 2.0, DOORS version 8.3.0.1
//Edited to select only modules in a specific folder.
//Just change "ERC" in line 48 to your folder name.
//To exclude a specific folder, change "==" to "!=" in the
//same line. - C. Annal 5/29/2009
pragma runLim, 0
void showIn(Object o, int depth) {
Link l
LinkRef lr
ModName_ otherMod = null
Module linkMod = null
ModuleVersion otherVersion = null
Object othero
string disp = null
string s = null
string plain, plainDisp
int plainTextLen
int count
bool doneOne = false
string linkModName = "*"
for lr in all(o<-linkModName) do {
otherMod = module (sourceVersion lr)
if (!null otherMod) {
if ((!isDeleted otherMod) && (null data(sourceVersion lr))) {
load((sourceVersion lr),false)
}
}
}
for l in all(o<-linkModName) do {
otherVersion = sourceVersion l
otherMod = module(otherVersion)
if (null otherMod || isDeleted otherMod) continue
othero = source l
if (null othero) {
load(otherVersion,false)
}
othero = source l
if (null othero) continue
if (isDeleted othero) continue

//added following line to Wizard script, to get parent folder name at this point - CA
fParentFolder = getParentFolder otherMod

doneOne = true
if (depth == 1) {
s = name(otherMod)

//added following line and extra brackets to Wizard script,
//to only display results from specific folder- CA
if (name(fParentFolder) == "ERC") {

if (isBaseline(otherVersion)) {
s = s " "
}
if (s == "")
displayRich("\\pard " " ")
else
displayRich("\\pard " s)
}
}
}
}
showIn(obj,1) //end of script

I really do want the simplest of scripts that would open the above modules and delete the links in the background. The suggested "parts" of the script I originally posted came from the Help files, but don't elaborate enough to get a working script.
I'm surprised that the concept of deleting inlinks isn't something covered in more detail by the Help files, since this has to be at the top of the list of things a user may have to do, and is time-consuming when dealing with numerous inlinks.

Re: Delete Inlinks from Target Object
llandale - Thu Jun 18 14:15:50 EDT 2009

ChrisAnnal - Thu Jun 18 10:05:02 EDT 2009
Thanks Louie, but I'm already sure of the inlinks I want to delete. I modified an Analysis Wizard script to display the module names of modules that are contained in a given folder, as follows:
// DXL generated by DOORS traceability wizard on 29 May 2009.
// Wizard version 2.0, DOORS version 8.3.0.1
//Edited to select only modules in a specific folder.
//Just change "ERC" in line 48 to your folder name.
//To exclude a specific folder, change "==" to "!=" in the
//same line. - C. Annal 5/29/2009
pragma runLim, 0
void showIn(Object o, int depth) {
Link l
LinkRef lr
ModName_ otherMod = null
Module linkMod = null
ModuleVersion otherVersion = null
Object othero
string disp = null
string s = null
string plain, plainDisp
int plainTextLen
int count
bool doneOne = false
string linkModName = "*"
for lr in all(o<-linkModName) do {
otherMod = module (sourceVersion lr)
if (!null otherMod) {
if ((!isDeleted otherMod) && (null data(sourceVersion lr))) {
load((sourceVersion lr),false)
}
}
}
for l in all(o<-linkModName) do {
otherVersion = sourceVersion l
otherMod = module(otherVersion)
if (null otherMod || isDeleted otherMod) continue
othero = source l
if (null othero) {
load(otherVersion,false)
}
othero = source l
if (null othero) continue
if (isDeleted othero) continue

//added following line to Wizard script, to get parent folder name at this point - CA
fParentFolder = getParentFolder otherMod

doneOne = true
if (depth == 1) {
s = name(otherMod)

//added following line and extra brackets to Wizard script,
//to only display results from specific folder- CA
if (name(fParentFolder) == "ERC") {

if (isBaseline(otherVersion)) {
s = s " "
}
if (s == "")
displayRich("\\pard " " ")
else
displayRich("\\pard " s)
}
}
}
}
showIn(obj,1) //end of script

I really do want the simplest of scripts that would open the above modules and delete the links in the background. The suggested "parts" of the script I originally posted came from the Help files, but don't elaborate enough to get a working script.
I'm surprised that the concept of deleting inlinks isn't something covered in more detail by the Help files, since this has to be at the top of the list of things a user may have to do, and is time-consuming when dealing with numerous inlinks.

You'll need to get the fullName(otherMod), open it Edit, then delete the link. Since this is in a Layout then dealingn with this other open edit module is quite a drag; the layout will need to either 'downgrade' it or 'close' it, which will take a lot of time.

You should make this an on-demand script and delete thise links in the 'foreground', only when you want to.

  • Louie

Re: Delete Inlinks from Target Object
ChrisAnnal - Thu Jul 23 16:54:22 EDT 2009

llandale - Thu Jun 18 14:15:50 EDT 2009
You'll need to get the fullName(otherMod), open it Edit, then delete the link. Since this is in a Layout then dealingn with this other open edit module is quite a drag; the layout will need to either 'downgrade' it or 'close' it, which will take a lot of time.

You should make this an on-demand script and delete thise links in the 'foreground', only when you want to.

  • Louie

I found a "Delete Links" Tool in the Kitchen tools from several years ago. It still brings up the dialog box and works in DOORS 8.3, which is what we're currently using. Basically, you still have to open all the modules that you want to delete the incoming links from, but once they are open, you can select any object in the "target" module and delete the incoming links using this tool. If you want to delete the incoming links from only certain sources, just open those modules and leave the ones that you want to keep incoming links from closed. There are two lines in the script that have to be modified:

#include <J:\apps\Doors User Files\AddIns\IncludeFiles\modules.inc>
#include <J:\apps\Doors User Files\AddIns\IncludeFiles\deltree.inc>

The above lines are modified to point to wherever you put the include files being referenced. I'm going to try to attach the DXL script for the tool, as well as both of the above include files.

Good Luck!!
Attachments

attachment_14277793_Delete_Links_Tool.dxl

Re: Delete Inlinks from Target Object
ChrisAnnal - Thu Jul 23 16:55:42 EDT 2009

ChrisAnnal - Thu Jul 23 16:54:22 EDT 2009
I found a "Delete Links" Tool in the Kitchen tools from several years ago. It still brings up the dialog box and works in DOORS 8.3, which is what we're currently using. Basically, you still have to open all the modules that you want to delete the incoming links from, but once they are open, you can select any object in the "target" module and delete the incoming links using this tool. If you want to delete the incoming links from only certain sources, just open those modules and leave the ones that you want to keep incoming links from closed. There are two lines in the script that have to be modified:

#include <J:\apps\Doors User Files\AddIns\IncludeFiles\modules.inc>
#include <J:\apps\Doors User Files\AddIns\IncludeFiles\deltree.inc>

The above lines are modified to point to wherever you put the include files being referenced. I'm going to try to attach the DXL script for the tool, as well as both of the above include files.

Good Luck!!

I can only add 1 file per posting. I'll try to add each include file separately.
Attachments

attachment_14277795_deltree.inc

Re: Delete Inlinks from Target Object
ChrisAnnal - Thu Jul 23 16:56:23 EDT 2009

ChrisAnnal - Thu Jul 23 16:55:42 EDT 2009
I can only add 1 file per posting. I'll try to add each include file separately.

Here's the last file you'll need.
Attachments

attachment_14277796_modules.inc