I'm writing a DXL script to extract history information from all objects and write some of the history parameters into other attributes (columns) in the DOORS module. I started out with the example script in the DXL Reference Manual (rev 9.6, near page 333), which just prints the information into the DXL editor window. I tried to add some code to write to the attribute _Reviewer
-- see below. The code as written looks at the currently selected object rather than the one to which the current h
history belongs to. What's the safest variable to pass into the function print
so I can access the desired object and write to its _Reviewer
attribute?
// history DXL Example
/* from doors manual
Example history DXL program.
Generate a report of the current Module's
history.
*/
// print a brief report of the history record
// hs is a variable of type HistorySession
// module is a variable of type Module
void print(History h) {
HistoryType ht = h.type
print h.author "\t" h.date "\t" ht "\t"
//next 3 lines are the code I added to the manual's example
Buffer authortmp = create;
authortmp = h.author "\t" h.date "\t" ht "\t"
(current Object)."_Reviewer" = authortmp;
// other code from original deleted
}
// Main program
History h
print "All history\n\n"
for h in current Module do print h
print "\nHistory for current Object\n\n"
for h in current Object do print h
print "\nNon object history\n\n"
for h in top current Module do print h
I imagine that you want to set the _Reviewer attribute not only for one object but rather for all objects of the module. So you will have a loop over all objects and for each object you will have a loop over each of its history entries.
So, the main loop would be like
and your function
getHistoryContent
would be similar to your functionvoid print (History h)
, only that you will return a string instead of printing the history entry. Something likeOne additional hint: you wrote "into other attributes (columns)". The above solution is for persistent attributes. Instead of this, you might want to show the information in a view as a DXL Layout column or or as a DXL attribute -- both possibilities have the advantage that the information is more or less always up to date, but with a persistent attribute the information will only be current after you run the script. Also note that this approach will only give you the changes since the last baseline. If you need more, the problem will be more complex. See the Rational DXL forum or google for more complex solutions of showing history entries
//Edit: removed typo in string concatenation, use Buffer insted