I wrote what I thought was a simple script to run in a DXL Layout column. The intent is to simply flag an object if any of it's attributes changed (including Object Text), since the last baseline.
I used the Tools > Module Compare... tool to show all changes, which worked well, but now I just want to filter on those objects that actually changed. If I filter on the "Last Modified" attribute unfortunately it will show all objects - since the tool creates links between all "current" objects to their baselined counterpart.
Anyway, here's what I came up with, but it produces a DXL error in the do loop:
// display text flag if object attribute changed since baseline
History hr
HistoryType ht = hr.type
Object obj
for (ht in obj) do
{
if (ht == modifyAttr)
display "Object Changed Since Baseline"
}
// end
The DOORS help mentions you can only access objects of type History and HistoryType using the for history record in type loop. I KNOW I'm missing something simple here, but after playing around for about half-an-hour, I realized someone else needed to look at it and enlighten me.
Thanks for your help!!
Chris AnnalSW Test Engineer / DOORS Database AdministratorSensis Corporation, East Syracuse, New Yorkchrisa@sensis.com
ChrisAnnal - Thu Mar 24 11:00:16 EDT 2011 |
|
Re: History since baseline ChrisAnnal - Thu Mar 24 11:04:18 EDT 2011
Just thought that maybe I was missing braces in the "if" statement inside the loop, but this doesn't work, either...
History hr
HistoryType ht = hr.type
Object obj
for (ht in obj) do
{
if (ht == modifyAttr)
{
display "Object Changed Since Baseline"
}
}
Chris AnnalSW Test Engineer / DOORS Database AdministratorSensis Corporation, East Syracuse, New Yorkchrisa@sensis.com
|
|
Re: History since baseline llandale - Thu Mar 24 14:31:40 EDT 2011
Forget the Compare. You won't be able to use Layout to produce a Filter effect itself (a layout cannot 'reject' the current object without DOORS abort).
Consider this solution: create an Attr-DXL that simply sets a flag when the object has changed since Baseline. Either add that attr to a view or define a view filtering on that attr.
The Attr-DXL would simply look through History such as you've done:
// display text flag if object attribute changed since baseline
History hr
HistoryType ht
// Object obj // 'obj' already defined in attr-DXL
string Result = " " // Better than null "" for attr-DXL.
for (hr in obj) do
{ ht = hr.type
if (ht == modifyAttr)
{ Result = "Modified since Baseline"
break // No need to keep looking
}
}
noError()
obj.attrDXLName = Result
lastError()
You could also derive the Baseline date of the Module from the 1st Module level history, get its date, then compare the object's Last Modified Date with that; but yo0u will then also get hits for objects that were moved.
Now your filter needs to see that "not changed" is implemented with a space not a null; perhaps filter for the attr starting with "Modified".
What the heck, I'd count the number of changes and display that.
|
|
Re: History since baseline ChrisAnnal - Thu Mar 24 15:06:17 EDT 2011 llandale - Thu Mar 24 14:31:40 EDT 2011
Forget the Compare. You won't be able to use Layout to produce a Filter effect itself (a layout cannot 'reject' the current object without DOORS abort).
Consider this solution: create an Attr-DXL that simply sets a flag when the object has changed since Baseline. Either add that attr to a view or define a view filtering on that attr.
The Attr-DXL would simply look through History such as you've done:
// display text flag if object attribute changed since baseline
History hr
HistoryType ht
// Object obj // 'obj' already defined in attr-DXL
string Result = " " // Better than null "" for attr-DXL.
for (hr in obj) do
{ ht = hr.type
if (ht == modifyAttr)
{ Result = "Modified since Baseline"
break // No need to keep looking
}
}
noError()
obj.attrDXLName = Result
lastError()
You could also derive the Baseline date of the Module from the 1st Module level history, get its date, then compare the object's Last Modified Date with that; but yo0u will then also get hits for objects that were moved.
Now your filter needs to see that "not changed" is implemented with a space not a null; perhaps filter for the attr starting with "Modified".
What the heck, I'd count the number of changes and display that.
Thanks Louie,
For some reason, I still get the following when I try to run what you suggested using a new DXL attribute with that script as it's contents:
-E- DXL: <Line:6> syntax error
-I- DXL: All done. Errors reported: 1. Warnings reported: 0.
This is that "for" loop that was giving me trouble in my script, too. I tried removing the brackets around "hr in obj" (see below)
for hr in obj do
{...
...but even though I no longer get the error message, I don't see any message flag "Modified since Baseline" in the DXL attribute column either.
I DID find an example using the "Browse" button when creating a DXL attribute that does the following:
This function sets the attribute it is driving to the number modifications (as history records) that have been made to the object.
For my purposes, this will work since any object that had an attribute modified will return "2" - one for the link that was created by the "Compare Modules..." tool and one for the attribute that was modified. I can then filter that column for anything other than "1" and get what I want.
I still don't know what syntax error the for loop is causing - I'm using DOORS 9.3.0.2 but thanks a lot for your help. It ultimately led me to the solution that works for me!!
:)
Chris Annal
SW Test Engineer / DOORS Database Administrator Sensis Corporation, East Syracuse, New York
chrisa@sensis.com
|
|
Re: History since baseline ChrisAnnal - Thu Mar 24 15:14:29 EDT 2011
Thanks Louie - Your suggestion regarding counting the number of mods was the solution I was looking for
|
|
Re: History since baseline adevicq - Fri Mar 25 07:07:23 EDT 2011 llandale - Thu Mar 24 14:31:40 EDT 2011
Forget the Compare. You won't be able to use Layout to produce a Filter effect itself (a layout cannot 'reject' the current object without DOORS abort).
Consider this solution: create an Attr-DXL that simply sets a flag when the object has changed since Baseline. Either add that attr to a view or define a view filtering on that attr.
The Attr-DXL would simply look through History such as you've done:
// display text flag if object attribute changed since baseline
History hr
HistoryType ht
// Object obj // 'obj' already defined in attr-DXL
string Result = " " // Better than null "" for attr-DXL.
for (hr in obj) do
{ ht = hr.type
if (ht == modifyAttr)
{ Result = "Modified since Baseline"
break // No need to keep looking
}
}
noError()
obj.attrDXLName = Result
lastError()
You could also derive the Baseline date of the Module from the 1st Module level history, get its date, then compare the object's Last Modified Date with that; but yo0u will then also get hits for objects that were moved.
Now your filter needs to see that "not changed" is implemented with a space not a null; perhaps filter for the attr starting with "Modified".
What the heck, I'd count the number of changes and display that.
Louie,
You suggest to compare the modification date of an object to the baseline date. But tell me if I'm wrong: there is no history which date is less than the baseline date in a module no?
Couldn't it be possible to filter the objects which change date is > baseline date??? This would avoid the creation of a specific attribute. (I'm not very used to filters in DXL and I cannot find a way to filter on the "Last Modified On" attribute...)
I get the baseline date this way
History hr
HistoryType ht
Module m = current
Date d = null
for hr in m do {
ht = hr.type
if (ht == baselineModule) {
d = hr.date
print stringOf(d) "\n"
break
}
}
How do you set the filter???
Thanks for you answer.
Alain
|
|
Re: History since baseline adevicq - Fri Mar 25 12:13:49 EDT 2011 ChrisAnnal - Thu Mar 24 15:14:29 EDT 2011
Thanks Louie - Your suggestion regarding counting the number of mods was the solution I was looking for
Hi
Here is a filter on objects that have been modified since the baseline.
Hope this helps..
Alain
History hr
HistoryType ht
Date d = null
Module m = current
for hr in m do {
ht = hr.type
if (ht == baselineModule) {
d = hr.date
break
}
}
if (d == null)
halt
set(attribute("Last Modified On") > stringOf(d))
filtering(on)
|
|