0

I created a new major baseline in a DOORS module and then ran a small DXL script which includes lines

 Module mp = current
Baseline bp = getMostRecentBaseline(mp)
int majorVersion = major(bp)
int minorVersion = minor(bp)
print "major " majorVersion " minor " minorVersion "\n"
string suff = suffix(bp)
print "suffix " suff "\n"
bool bstat
bstat = isBaseline(mp)
print "bstat " bstat "\n"
ModuleVersion mv = moduleVersion(mp)
string basind = baselineIndex(mp)
print "baseline index " basind "\n"
bool otherbstat = baseline(mp)
print "otherstat " otherbstat "\n"
bool basv = isBaseline(mv)
print "version base " basv "\n"  

All of these return FALSE, indicating the module is not currently baselined. I have not done any edits to any attributes since baselining. I have done things like creating new Views. If I run the IBM DXL macro to compare the latest baseline against the "Current" version, it reports there are zero differences.

So my question is - what do the various isBaseline functions look at that is causing them to return FALSE? Or, am I going about this the wrong way - all I really need is a Q&D bit of DXL code to check that my module hasn't been edited for content since the last baseline was established.

Carl Witthoft
  • 20,573
  • 9
  • 43
  • 73

2 Answers2

1

The primary issue is that when your code gets a ModuleVersion (line 11), it uses a form of the function that gets the current version of the module. Line 14 should invoke isBaseline, not baseline, making the last two lines redundant.

See p310 of the current version (9.6.1) of the DXL Reference Manual for full details of the moduleVersion function.

The minimally modified version of your code that gets the result I think you were expecting, follows:

Module mp = current
Baseline bp = getMostRecentBaseline(mp)
int majorVersion = major(bp)
int minorVersion = minor(bp)
print "major " majorVersion " minor " minorVersion "\n"
string suff = suffix(bp)
print "suffix " suff "\n"
bool bstat
bstat = isBaseline(mp)
print "bstat " bstat "\n"
ModuleVersion mv = moduleVersion(uniqueID(mp), bp)
string basind = baselineIndex(mp)
print "baseline index " basind "\n"
bool otherbstat = isBaseline(mv)
print "otherstat " otherbstat "\n"
bool basv = isBaseline(mv)
print "version base " basv "\n"  

In the version below, I've renamed variables, reordered some lines, and removed some content that wasn't required, for clarity:

Module modCurrent   = current
Baseline blLatest   = getMostRecentBaseline(modCurrent)

int iMajorVersion   = major(blLatest)
int iMinorVersion   = minor(blLatest)

string sBLSuffix    = suffix(blLatest)

print "last baseline: major " iMajorVersion " minor " iMinorVersion " suffix " sBLSuffix "\n"

bool bIsBaseline = isBaseline(modCurrent)

print "bIsBaseline = " bIsBaseline "\n"

ModuleVersion mv    = moduleVersion(uniqueID(modCurrent), blLatest)
Module modBaselined = load(mv, false)

string basind = baselineIndex(modBaselined)

print "baseline index = " basind "\n"

bIsBaseline = isBaseline(modBaselined)

print "bIsBaseline = " bIsBaseline "\n"

close(modBaselined)
  • Thank you. I had provided redundant approaches just to show they all seemed to derive the same result. Your code is helpful – Carl Witthoft Aug 31 '18 at 12:57
  • Ah, makes sense. You’re most welcome, Carl. Would you please click the ‘up’ arrow next to my answer to record a ‘vote’ for it? Thank you. – Richard Hesketh Sep 03 '18 at 07:20
0

Looks like isBaseline returns TRUE only if the current module View is set to display a selected baseline, as opposed to the "current" working view. `isBaseline and its brethren do not look at module contents, and thus won't see any potential differences between a baseline version and the current working view.

I'm aware of various DXL tools which perform a 'compare' on the contents, so that can be dealt with separately. As noted at this question, there are enhanced versions of the default "compare" script, such as one posted at this DOORS forum

Carl Witthoft
  • 20,573
  • 9
  • 43
  • 73