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: Finding the most recently modified object
Topic Summary:
Created On: 16-Mar-2005 09: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.
 16-Mar-2005 09:47
User is offline View Users Profile Print this message


Paul Worrall

Posts: 87
Joined: 30-Sep-2003

The attached code prints out "createAttr" (which is the type of the last history record in the module), and not "modifyObject" as you might expect Am I misunderstanding something?
Report this to a Moderator Report this to a Moderator
 16-Mar-2005 18:31
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

History is a history record
HistoryType is a type of history 

You were mixing & matching. See proper use in example code

History h

HistoryType ht

for h in current Module do

{ ht = h.type

   if (ht == modifyObject ) print ht  "\n"
}

Report this to a Moderator Report this to a Moderator
 17-Mar-2005 14:02
User is offline View Users Profile Print this message


Paul Worrall

Posts: 87
Joined: 30-Sep-2003

Ron,

My code is attempting to find the last History record which has the type 'modifyObject'. The 'for' loop only assigns history records of type 'modifyObject' to hmo, so on completion of the loop I am surprised to find it referring to a history record of type 'createAttr'. I don't see how I am 'mixing & matching' anything.
Report this to a Moderator Report this to a Moderator
 17-Mar-2005 14:09
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

the dxl help file does not show your use of if (h.type == modifyObject) as being correct
Report this to a Moderator Report this to a Moderator
 18-Mar-2005 11:48
User is offline View Users Profile Print this message


Jonathan Marshall

Posts: 27
Joined: 10-Apr-2003

Paul

The problem is that hmo and h are references. When you assign hmo=h you are not making a copy of the value, you are making the address pointed to by hmo equal to the address pointed to by h. Therefore, as soon as the if statement evaluates to true once, the value returned by hmo is permanently the same as the value returned by h whether or not the if statement ever evaluates to true again.

If you want to store the information in h when the if statement is true then you need to extract it from the history record at that point and store it in some other type of variable.

Jon

-------------------------
Jonathan Marshall
EADS Astrium

Edited: 18-Mar-2005 at 12:01 by Jonathan Marshall
Report this to a Moderator Report this to a Moderator
 18-Mar-2005 13:31
User is offline View Users Profile Print this message


Paul Worrall

Posts: 87
Joined: 30-Sep-2003

Are History variables unique in this behaviour? The following two loops work as I would have expected (i.e. they print "Object Text" and "45" respectively):

Edited: 18-Mar-2005 at 13:33 by Paul Worrall
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.