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: tracing the target module from a link and opening it
Topic Summary: tracing the target module from a link and opening it
Created On: 29-Nov-2005 13:11
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.
Answer This question was answered by Chris Jones, on Wednesday, November 30, 2005 6:41 AM

Answer:
You can do a for link in object loop to get each link, and then use source(). It can give a string of the module's name, a ModName_ referring to the module, or an Object of the actual linked object, all depending on how you use it. Here's a little sample:

Link l = null
for l in current Object do {
print source(l) "\n"
}

Inside that loop you can read (open) the module with read(source(l)), or do any other number of things. I'm not quite sure what you're looking to do, but I hope that helps!

-Chris
 29-Nov-2005 13:11
User is offline View Users Profile Print this message


martin allman

Posts: 74
Joined: 25-Jul-2005

I have three modules a and b, c.  a contains outlinks to b and c.  I want to run a dxl script from module a that returns a handle to whichever module a particular link points at, in order that I can open and edit that module.  Grateful for any advive.
Report this to a Moderator Report this to a Moderator
 29-Nov-2005 22:13
User is offline View Users Profile Print this message


Chris Jones

Posts: 177
Joined: 1-Jul-2005

Answer Answer
You can do a for link in object loop to get each link, and then use source(). It can give a string of the module's name, a ModName_ referring to the module, or an Object of the actual linked object, all depending on how you use it. Here's a little sample:

Link l = null
for l in current Object do {
print source(l) "\n"
}

Inside that loop you can read (open) the module with read(source(l)), or do any other number of things. I'm not quite sure what you're looking to do, but I hope that helps!

-Chris
Report this to a Moderator Report this to a Moderator
 30-Nov-2005 06:42
User is offline View Users Profile Print this message


martin allman

Posts: 74
Joined: 25-Jul-2005

Thanks Chris, much appreciated!
Report this to a Moderator Report this to a Moderator
 30-Nov-2005 10:54
User is offline View Users Profile Print this message


Paul Worrall

Posts: 87
Joined: 30-Sep-2003

quote:

Originally posted by: Chris Jones
You can do a for link in object loop to get each link, and then use source(). It can give a string of the module's name, a ModName_ referring to the module, or an Object of the actual linked object, all depending on how you use it. Here's a little sample:



Link l = null

for l in current Object do {

print source(l) "\n"

}



Inside that loop you can read (open) the module with read(source(l)), or do any other number of things. I'm not quite sure what you're looking to do, but I hope that helps!



-Chris

If you use a variable of type "Link" in your loop, it will only process links whose source module is open, so this is OK for out-links but for in-links you probably want a variable of type LinkRef to process links coming from closed modules. Also, the loop control statement needs to state the name of the link module, or "*" for any link module thus for in-links:

LinkRef lr
for lr in (current Object) <- "*" do {
print source lr "\n"
}

And for out-links:

Link l
for l in (current Object) -> "*" do {
print target l "\n"
}
Report this to a Moderator Report this to a Moderator
 2-Dec-2005 18:48
User is offline View Users Profile Print this message


Chris Jones

Posts: 177
Joined: 1-Jul-2005

Oh yeah, I forgot about the
-> "*"
bit in the for loop. That can filter links based on the link module they use. I pretty much always forget it in code, and then it reminds me with some errors.
Report this to a Moderator Report this to a Moderator
 2-Dec-2005 21:39
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

The "for SrcModName in obj <- "*"" loop and the "string source(link)" command both deal only with Unqualified module names; making them useful ONLY when the module is in the same folder as the target module, which is rarely the case. Thus, getting the source name and then trying to open it will fail most of the time and is thus useless for general DXLs.

Instead, get the "ModName_ source(link)" command, then dirive the full name, then open it:
ModName_ mnSource = source(lnk)
string NameSourceFull = fullName(mnSource)
Module mSource = read(NameSourceFull, false)

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