Search code examples
ibm-doors

How to get author of oldValue


Is there any way we can get author of oldValue using history in dxl?

I want to extract the name of author who has written the oldValue (previous to current history record) for a Object in DOORS.


Solution

  • The old value of which attribute? I assume "Object Text" or "Object Heading". The general idea is: iterate over all history entries (e.g. History h) of the Object in question (backwards in time), until you find a history entry with h.type being modifyObject and with the h.attrName being "Object Text" (or "Object Heading" or whatever attribute you are interested in). This is the entry that changed h.oldValue to h.newValue. If you found the entry you see the old Value in h.oldValue. Then you will go further backwards in time until you find the next entry with h.type == modifyObject and h.attrName == "Object Text", which will be the entry that you are looking for, the one that changed "very old value" to the "old value". Of this one you will want to get h.author.

    If there are no two such history entry in the current Module, it could be that either the Object has just been created (then you are looking for the history entry with h.type == createObject), or that the Object has been modified / created in a previous baseline. In that case, you have to iterate over all Baselines of the Module (backwards in time), load each baseline and repeat the process.

    On http://www.smartdxl.com/content/?page_id=125 there is a good script "Smart History Viewer" by Tony Goodman which does exactly that. In that script you will find all the code snippets that you need.