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: History date
Topic Summary: Find the latest history date
Created On: 14-Jan-2007 12:54
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.
 14-Jan-2007 12:54
User is offline View Users Profile Print this message


Krishna Kandala

Posts: 170
Joined: 8-Jul-2006

I am working on a script to find the latest date of modifying a history record for the attributes of an object in a module. I want to set a function for getting the latest date and by assigning the required attribute names as the arg for the function. The code is attached.
When I run the script , I get the run time error "Unassigned value (hst)". If do away with the function, and run the same code for any specific attribute, it runs fine.
I believe that I am doing some mistake in constructing the function and calling it. I'll appreciate if someone can advise me where I am going wrong.

Thanks in advance
Report this to a Moderator Report this to a Moderator
 14-Jan-2007 16:34
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

You need to assign hist a value:

Something like:
for hist in o do {}
Report this to a Moderator Report this to a Moderator
 15-Jan-2007 23:07
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Its odd that you pass 'hst' to a function but don't intend to use it. If you do, the calling program must set 'hst = null' or you get the error at the point of the call. In your case you should just remove hst from the call parameter list and declare it locally in your function.

Be advised that the History variable, at least in v7.1, isn't a variable like you'ld think. I wrote a function to do what you were doing, remembering the latest History that modified an object-attribute, something like this:

for hst in obj do
{ if (This is the kind of hst I want) then hstRemember = hst
}
return(hstRemember)

That didn't work since the setting of 'hstRemember = hst' did NOT remember the history value but instead set an Alias; thus as the loop continued hstRemember was continuously updated to the new value of hst. This alias is similar to setting a buffer to a buffer: bufA = bufB which doesn't copy the buffer but just sets bufA to be an alias for bufB: delete bufB and bufA goes also. The function always returned the last history in the object.

Anyway, I solved this problem with History this way:
for hst in obj do
{ Count++
if (This is the kind of hst I want) then countRemember = Count
}
Count = 0
for hst in obj do
{ Count++
if (Count ==countRemember) then return(hst)
}

- Louie
Report this to a Moderator Report this to a Moderator
 17-Jan-2007 23:58
User is offline View Users Profile Print this message


Krishna Kandala

Posts: 170
Joined: 8-Jul-2006

Thanks for the detailed explanation. I was trying to use "History" as a normal variable in a function.
In fact I am only interested to collect the most recent history record for the specific attributes. The following code will give me the required dates:

for hst in o do {
  if (hst.attrName == //specific attribute) {
     Date d = hst.date
     string modDate = d""
  }
}
As already explained the buffer gets updated and the latest date is given.

- Krishna

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