Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Is there a Previous baseline function in DOORS DXL

 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

0 votes


Accepted answer

Permanent link

 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

0 votes

Comments

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

 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

 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


0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 29

Question asked: Aug 20 '21, 10:14 a.m.

Question was seen: 2,754 times

Last updated: Sep 01 '21, 12:05 a.m.

Related questions
Confirmation Cancel Confirm