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: Simple Link
Topic Summary:
Created On: 10-Feb-2004 15:39
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 Damon Begley, on Wednesday, February 11, 2004 7:06 PM

Answer:
I wanted to create a set of links in Excel that would link as previously described. The link criteria, which I am not responsible for, is not always consistant and can be based on more than one attribute. I found a way to link objects by passing their Absolute Numbers through a function. The attached code is what I came up with. Any improvements/comments are welcome. Thanks again.
 10-Feb-2004 15:39
User is offline View Users Profile Print this message


Damon Begley

Posts: 9
Joined: 12-Aug-2003

Thanks in advance for your help. I want to link object 1 in module A to object 2 in module B.

This code links object 1 to object 2 in module A.

(object 1) -> modLink -> (object 2)

where modLink is the link module. I am having trouble indicating object 2 is in module B. Any ideas?

Report this to a Moderator Report this to a Moderator
 10-Feb-2004 20:32
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

the "object" parameters need to be of type "Object"; specifically they are NOT absolute numbers or paragraph numbers. Once you have the handle (in an open module) DXL knows what module its in.

Seems to me there was a command "find" that found Objects given the Absolute Number, but I cannot find it in the manual.

You may want to trap errors:
noError()
oSource ->NameLM ->oTarget
string ErrMess = lastError()
if (!null ErrMess) print "Failed to create link: " ErrMess

That's better than having your DXL abort if there is an error, such as if you forget to open the source module Edit.

- Louie
Report this to a Moderator Report this to a Moderator
 10-Feb-2004 20:55
User is offline View Users Profile Print this message


Damon Begley

Posts: 9
Joined: 12-Aug-2003

I think I have read the help/manual at least five times. It seems like it should be no big deal. Ideally what I would like to do is link absolute numbers from module A to module B. It isn't the syntax but it would look like this:

(module A (absolute number 1)) -> modLink -> (module B (absolute number 2))
Report this to a Moderator Report this to a Moderator
 10-Feb-2004 21:36
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Are you saying you know the AbsNos of the two objects, but need to translate them into "Object"s?
Report this to a Moderator Report this to a Moderator
 10-Feb-2004 21:39
User is offline View Users Profile Print this message


Damon Begley

Posts: 9
Joined: 12-Aug-2003

I know both absolute numbers but can't get the link to work. I can link within the module I am currently in but can't find a way to link absolute numbers across modules. It should be one line of DXL.
Report this to a Moderator Report this to a Moderator
 10-Feb-2004 21:51
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

I don't understand "linking absolute numbers". Maybe you need to post some code.

But I did just locate the command in the "New" section of the v6 manual but cannot find it in the body of the manual. Looks like its:
Object object(int AbsNo): find the Object with that AbsNo.

This command only seems to work on the "current" module. To use it on another module you'll need to issue something like:
(current ModuleRef__) = modTarget
Object oTarget = object(AbsNo)

Don't forget to change the current module back when searching for the Source module.

Edit: v7 manual has an optional parameter Object oTarget = object(AbsNo, mTarget) which will relieve you the need to switch current modules. There is a great chance that command works in v6 as well.

If memory serves this command only finds currently displayed objects, not any object. That pretty much puts it in the "don't bother using it" pile. Instead, I wrote my own clever searcher that works best when you are searching the same module repeatedly.

- Louie


Edited: 10-Feb-2004 at 21:53 by Louie Landale
Report this to a Moderator Report this to a Moderator
 11-Feb-2004 19:02
User is offline View Users Profile Print this message


Damon Begley

Posts: 9
Joined: 12-Aug-2003

Answer Answer
I wanted to create a set of links in Excel that would link as previously described. The link criteria, which I am not responsible for, is not always consistant and can be based on more than one attribute. I found a way to link objects by passing their Absolute Numbers through a function. The attached code is what I came up with. Any improvements/comments are welcome. Thanks again.
Report this to a Moderator Report this to a Moderator
 11-Feb-2004 21:06
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

In a previous post I mentioned noError()/lastError() code to trap errors.

Be advised that the "for obj in mod" loop only works for DISPLAYED objects. If the default module
view for these modules has some sort of Filter on it, then not all live objects will be displayed
and therefore not all objects will be FOUND by your loops. Dealing with this is a little tricky.
Use the "for obj in entire mod" loop, then make sure the found object isn't a row(o), table(o),
isDeleted(o).

Its "bad practice" to use lots of global variables. In this case you should declare o,e,i, and j INSIDE
the ABS_Link function. I'd put "counter" in there also but return it as a call parameter, and of course
change "void ABS_Link" to "int ABS_Link".

The for o in mod loops are relatively slow. In fact, lots of object searches WILL bog down the DXL.
For repeated searches its quite a bit faster to put all the Objects and their AbsNos in a Skip list,
then search the Skip list.

- Louie

- Louie
Report this to a Moderator Report this to a Moderator
 12-Feb-2004 14:41
User is offline View Users Profile Print this message


Damon Begley

Posts: 9
Joined: 12-Aug-2003

Thanks for the good information/ideas. I happen to discover the “for o in m” loop
only applies to visible objects. I think it is almost a desirable feature if working with
subsets of data.

If I put the variables inside function does DXL create and destroy their allocation
with every function call or once during run time?

I hated to brute force the linking but could not find another alternative. I know about
the skip list but have not started using them yet. I am still getting my DXL feet wet.
In a test environment the posted script linked 10,000 objects in less than 4 minutes.

Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 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 0 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.