How to load the created baseline and print using DXL

Am trying to create a baseline, load it and print the document using DXL.

int iMajor = 0
int iMinor = 0
string sSuffix =""

Object curObj = current
Module old = current
Baseline b = getMostRecentBaseline(current)
current = old

Module m = module curObj
for b in m do 
{
iMajor = (major b)
iMinor = (minor b)      
  if ((suffix b) != "")
  {
        sSuffix = (suffix b)             
  }     
}// for all baselines  

if(sSuffix!="")
{
        print "No Support for Suffix!"
}

if(iMinor > 9)
{     
        if(confirm "Minor Revision exceeds 9, so create a new baseline with new major?")
        {
                create(nextMajor, "Creation of New Baseline using DXL")               
        }
}else
{    
        if(confirm "Minor Revision less than 9, so create a new baseline with new minor?")
        {
                create(nextMinor, "Creation of New Baseline using DXL")
        }
}

// DOORS Crashes here, because it's a null object now
Baseline latestBase = getMostRecentBaseline(current)
Module baseMod = load(latestBase, true)

Any help will be appreciated. Thanks.


Dk3456 - Sat Oct 27 19:23:52 EDT 2018

Re: How to load the created baseline and print using DXL
PekkaMakinen - Sun Oct 28 03:12:53 EDT 2018

When DOORS creates a baseline it will close and reload the module where the baseline was created. That means those references to current object and module are not anymore valid.

Two options for you:

- instead of running your script from module context, run it from the database window Edit DXL and manage the loading of modules and baseline creation there

or

- separate the actions of creating a new baseline and printing it