It's all about the answers!

Ask a question

Is there a Previous baseline function in DOORS DXL


Christopher Cote (15117) | asked Aug 20 '21, 10:14 a.m.

 I know that there are the nextMajor and nextMinor functions to get those baselines, but is there a way to start at the current baseline and go to the previous baseline?  I currently have a module that gives information about some scripts we created here at work.  We'd like to create a function that will give the changes we've made to the script between individual baselines, so I'd like to loop through the baselines between the current baseline and the previous baseline then move one to the baseline before that to compare it against the 2nd baseline until we get to the last selected baseline.  If it can't be done, then I can start from the older baseline chosen and use the nextMajor and nextMinor functions, but I'd rather give the changes in reverse order so that users can see the history of the module.


Chris

Accepted answer


permanent link
stuart green (661) | answered Aug 24 '21, 8:50 a.m.

 The function below returns the Baseline handle for the previous baseline, you can then load/compare as required.


"
// Uses unique version string of current() module to find previous baseline
// Returns null if current() is oldest baseline
// Return newest baseline if current() is the actual current version

Baseline getPreviousBaseline(Module m){

Baseline b
Baseline prevB = null
string curVerStr = versionString moduleVersion m
string blVerStr

if (isBaseline m) print "bl"

for b in m do {


blVerStr = versionString moduleVersion (module m, b)

if (blVerStr == curVerStr) { //return previous baseline

if (prevB == null) { //indicates current is oldest baseline
return null
}

return prevB
}
prevB = b
}

//if the current version-string doesn't match any baseline it must be the actual (non-baseline) current version
//in which case the previous baseline is the newest baseline, which is the last in the above loop
return b 
}

//E.g.
Module m = current
Baseline pb = getPreviousBaseline m
if (null pb) print "current is oldest"
else print "prev baseline : " versionString moduleVersion(module m, pb)
"

Hope this helps,
Stuart.

Christopher Cote selected this answer as the correct answer

Comments
Christopher Cote commented Aug 24 '21, 11:06 a.m.

So, I assume that if I wanted to get all previous baselines to do something with them, I would use a for-loop or while (!null pb)

Chris


stuart green commented Aug 26 '21, 10:09 a.m.

 Yes, exactly, so e.g. the following opens all previous baselines in reverse order:


Module m = current
Baseline pb = getPreviousBaseline m
Module bMod

while (!null pb) {
bMod = load (m, pb, true)
pb = getPreviousBaseline bMod
}

One other answer



permanent link
Manleystad Hilpert (111) | answered Aug 31 '21, 4:58 a.m.
edited Sep 01 '21, 12:05 a.m.

 When two companies are using DOORS and need to exchange information then the requirements are often provided from one company to another by means of DOORS module archives (.dma). This means that the version that you have been working with your own changes is now superseded by a new module. Target MyBalanceNow


Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.