![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
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 |
![]() |
![]()
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
You need to assign hist a value:
Something like: for hist in o do {} |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
History date
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.