Check if one or more baseline exists for a formal or link module

How do I check if a baseline exists for a module? When I use the function baselineExists(Module m, Baseline b), what should I pass for "b"? I mean, How do I initialize "b" at the first place when I don't know if baseline exists or not?!

I don't have anything to do with minors, majors or suffix. I just have to check whether one or more baseline exists for a formal or link module.

 

Any help will be much appreciated. Thanks in advance.


cron7 - Tue Feb 06 07:42:49 EST 2018

Re: Check if one or more baseline exists for a formal or link module
Mike.Scharnow - Tue Feb 06 08:01:04 EST 2018

bool thereIsABaseline = false
Baseline b
Module m = xxx
for b in m do {
  thereIsABaseline = true
  break
}

Link modules or descriptive modules do not have baselines, only formal modules.

 

Edit: sorry, don't name your variable after a resverved keyword...

Re: Check if one or more baseline exists for a formal or link module
cron7 - Wed Feb 07 06:02:23 EST 2018

Mike.Scharnow - Tue Feb 06 08:01:04 EST 2018

bool thereIsABaseline = false
Baseline b
Module m = xxx
for b in m do {
  thereIsABaseline = true
  break
}

Link modules or descriptive modules do not have baselines, only formal modules.

 

Edit: sorry, don't name your variable after a resverved keyword...

Thanks Mike. I'm sorry but I'm a bit new to dxl.

Actually, I am passing the full name of the formal as argument and then checking if any baseline exists for that formal module in a different function.

-------------

void processFormal(string mName)
{
    print("Formal Module: " mName "\n")
    //print(uniqueID(mName) "\n")

 

   //Check if baseline exists for this formal
}

---------------------

 

So, for this, how should I assign the formal module's name to 'm'?

 

Again, thanks for your answers. :)

Re: Check if one or more baseline exists for a formal or link module
cron7 - Thu Feb 08 02:07:06 EST 2018

Mike.Scharnow - Tue Feb 06 08:01:04 EST 2018

bool thereIsABaseline = false
Baseline b
Module m = xxx
for b in m do {
  thereIsABaseline = true
  break
}

Link modules or descriptive modules do not have baselines, only formal modules.

 

Edit: sorry, don't name your variable after a resverved keyword...

Hi Mike, when I run your script I get the following error :

"null Baseline do loop parameter was passed"

Re: Check if one or more baseline exists for a formal or link module
PekkaMakinen - Thu Feb 08 03:17:17 EST 2018

cron7 - Wed Feb 07 06:02:23 EST 2018

Thanks Mike. I'm sorry but I'm a bit new to dxl.

Actually, I am passing the full name of the formal as argument and then checking if any baseline exists for that formal module in a different function.

-------------

void processFormal(string mName)
{
    print("Formal Module: " mName "\n")
    //print(uniqueID(mName) "\n")

 

   //Check if baseline exists for this formal
}

---------------------

 

So, for this, how should I assign the formal module's name to 'm'?

 

Again, thanks for your answers. :)

You can get a Module handle by opening a module, for your application the read-only mode is sufficient, so:

Module m = read(mName, false)

See the "read", "share" and "edit" functions in the DXL Reference.

Or if you already have a module open, you can take that as current and modifying the above example script:

bool thereIsABaseline = false
Baseline b = null
Module m = current
for b in m do 
{
  thereIsABaseline = true
  if (suffix(b) > "") print major(b) "." minor(b) " (" suffix(b) ")\n"
  else print major(b) "." minor(b) "\n"
}
print "thereIsABaseline " thereIsABaseline "\n"

 

Re: Check if one or more baseline exists for a formal or link module
cron7 - Thu Feb 08 03:47:01 EST 2018

PekkaMakinen - Thu Feb 08 03:17:17 EST 2018

You can get a Module handle by opening a module, for your application the read-only mode is sufficient, so:

Module m = read(mName, false)

See the "read", "share" and "edit" functions in the DXL Reference.

Or if you already have a module open, you can take that as current and modifying the above example script:

bool thereIsABaseline = false
Baseline b = null
Module m = current
for b in m do 
{
  thereIsABaseline = true
  if (suffix(b) > "") print major(b) "." minor(b) " (" suffix(b) ")\n"
  else print major(b) "." minor(b) "\n"
}
print "thereIsABaseline " thereIsABaseline "\n"

 

Thanks a lot, it works. :)