![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
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 |
![]() |
![]()
|
![]() 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 | |
![]() |
|
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.
|
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
Thanks Chris, much appreciated!
|
|
![]() |
|
![]() |
|
quote: 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" } |
|
![]() |
|
![]() |
|
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. |
|
![]() |
|
![]() |
|
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 |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.