Topic
9 replies Latest Post - ‏2013-11-26T14:44:13Z by MohanRS
SystemAdmin
SystemAdmin
3180 Posts
ACCEPTED ANSWER

Pinned topic display dateOf baseline in current view of the module for variable baseline

‏2013-01-31T15:32:18Z |
When exporting to Word from a view in doors I want to capture the baseline applied. If the baseline in the view is not the most recent how would I get a handle on the baseline? For example if I am viewing baseline 1.1 but the most recent is 1.5 I need a handle on 1.1 to use the dateOf function. Additionally this has to be general so I can't simply create Baseline b = baseline(1,1,null) In essence I need a handle on the Module version in order to get the date the baseline was created. For example:

//I know this won't work but this is what I am trying to get
dateOf(version(Module m))

here is what I have tried so far:
//-----Start of code-----

Module m = current
string myVers = version(current)
ModuleVersion myHandle = moduleVersion(m)
Baseline b = baseline(ModuleVersion myHandle)
bool checkM = baselineExists(myHandle)
if (checkM == true) {
print "baseline exists"
}
else {
print "no baseline exists"
}

print dateOf(b)
//-------End of code--------

The problems:

-It says a baseline exists when in that view there is no baseline (verified by using the function getMostRecentBaseline(m)

-It will not print the dateOf(b) if a baseline does exist here is the error:
-R-E- DXL: <Line:13> null Baseline parameter was passed into argument position 1
-I- DXL: execution halted
Updated on 2013-02-01T14:03:29Z at 2013-02-01T14:03:29Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    3180 Posts
    ACCEPTED ANSWER

    Re: display dateOf baseline in current view of the module for variable baseline

    ‏2013-01-31T16:14:19Z  in response to SystemAdmin

    Not sure if I understood you correctly.
    Do you need something like

    Date d
    Module m = current
    if (baseline (m)) {
       // m is a baseline. Print the date when it was created
       d = dateOf (baselineInfo(m))
    } else {
       // m is current version. Print the date when the last baseline was created
       d = dateOf (getMostRecentBaseline(m))
    }
    print d
    
    Updated on 2014-01-06T13:55:43Z at 2014-01-06T13:55:43Z by iron-man
  • llandale
    llandale
    2943 Posts
    ACCEPTED ANSWER

    Re: display dateOf baseline in current view of the module for variable baseline

    ‏2013-01-31T16:20:38Z  in response to SystemAdmin

    You can cheat and use History. If you open a baseline and look at Module Properties >History tab, you see the 1st History in the module is the one that performed the Baseline.

    History hst = null
    HistoryType ht = null
    for hst in (current Module) do {break} // stop after 1 History
    if (null hst) then Louie is Wrong
    ht = hst.type
    if (ht != baselineModule) then Louie is Wrong
    Date datBaseline = hst.date
    


    -Louie

    Updated on 2014-01-06T13:56:02Z at 2014-01-06T13:56:02Z by iron-man
    • llandale
      llandale
      2943 Posts
      ACCEPTED ANSWER

      Re: display dateOf baseline in current view of the module for variable baseline

      ‏2013-01-31T16:28:17Z  in response to llandale
      Oops. The very first baseline has "createModule" as the 1st History.
      • if (ht != createModule and ht != baselineModule) then Louie is Wrong
      • SystemAdmin
        SystemAdmin
        3180 Posts
        ACCEPTED ANSWER

        Re: display dateOf baseline in current view of the module for variable baseline

        ‏2013-01-31T17:08:43Z  in response to llandale
        Thank you Louie that is an excellent snippet of code to accomplish this. My concern is how to verify if the version and date in the view is in fact an actual baseline or if it is the current version. I was going to use: bool baselineExists(Module m, Baseline b) but what would I use for the Baseline b argument if the current view does not have a baseline? Would an if null statement work?
        • llandale
          llandale
          2943 Posts
          ACCEPTED ANSWER

          Re: display dateOf baseline in current view of the module for variable baseline

          ‏2013-01-31T19:06:57Z  in response to SystemAdmin
          string version(Module)
          bool isBaseline(Module)
          • SystemAdmin
            SystemAdmin
            3180 Posts
            ACCEPTED ANSWER

            Re: display dateOf baseline in current view of the module for variable baseline

            ‏2013-01-31T20:30:45Z  in response to llandale
            yes but that only tells you if there is a baseline in the module, if I am in a current view that is not baselined (for example appears as yellow in DOORS instead of blue for a baseline) how do I know that the view is not baselined?
            • llandale
              llandale
              2943 Posts
              ACCEPTED ANSWER

              Re: display dateOf baseline in current view of the module for variable baseline

              ‏2013-01-31T21:07:11Z  in response to SystemAdmin

              isBaseline(Module) tells you if THIS open module is a baseline. false means it is the current module.

              if (isBaseline(module(obj))) //
              then display "baseline"
              else display "current"
              

              Views are not baselined. If you baseline a module then delete a view; that view is not available to any baseline.


              When you talk about yellow/blue, then perhaps you are asking if the OBJECT has been baselined since it was last modified. Here is some code reflecting my best guess on the topic:

               

              if    (isDeleted(obj))                  BackColor       = realColor_Black       // Black:       Deleted (saved)
              elseif(unsaved(obj) or new(obj))        BackColor       = realColor_Red         // Red:         Changed not yet saved
              elseif(saved(obj))                      BackColor       = realColor_Yellow      // Yellow:      modified since Baseline or module create
              else   
              


              -Louie

               

              Updated on 2014-01-06T13:56:35Z at 2014-01-06T13:56:35Z by iron-man
              • SystemAdmin
                SystemAdmin
                3180 Posts
                ACCEPTED ANSWER

                Re: display dateOf baseline in current view of the module for variable baseline

                ‏2013-02-01T14:03:29Z  in response to llandale
                Louie,

                You are right sorry I misunderstood before, thank you for your great help.
  • MohanRS
    MohanRS
    6 Posts
    ACCEPTED ANSWER

    Re: display dateOf baseline in current view of the module for variable baseline

    ‏2013-11-26T14:44:13Z  in response to SystemAdmin

    //Hope it helps

    Module m = current Module

    if(baselineIndex(m)=="1000000") //1000000 is default value if it not baselined before, colour indication won't help.
    {
    //nothing

    print "Not Baselined"
    }
    else{

    print "Baselined->"
    print fullName(m)

    print dateOf (getMostRecentBaseline(m)) "\n"

    }
    }

    Updated on 2013-11-26T14:48:50Z at 2013-11-26T14:48:50Z by MohanRS