How to identify the DOORS current session number?

Hello,

I need to compare the history session with the actual(current)DOORS session. I am able to retrieve the history session, but how can i identify the current DOORS session?

Regards,
Silveira
Silveirax - Mon May 23 14:48:59 EDT 2011

Re: How to identify the DOORS current session number?
SystemAdmin - Mon May 23 18:09:04 EDT 2011

Not entirely sure if I understand what you're trying to achieve here.

You want to compare a specific history session with the current history session - is that correct?

If yes - what exactly are you wanting to compare as the session number is just a number?

Are you wanting to compare the attribute data of objects as they were for a specific session with the attribute data of objects in the current session so that you can see the difference between two sessions?

Or, are you wanting to compare history record data between a specific session and the current session?
Paul Miller
Melbourne, Australia

Re: How to identify the DOORS current session number?
SystemAdmin - Mon May 23 19:35:40 EDT 2011

I should have at least provided you with some code inmy previous post to help you determine what the current session number is, use the code below which is based on an example provided in the DXL Reference Manual.

Some caution here, there seems to be an N+1 issue with the "for hs in current Module do" loop. The initial value of hs starts at 0 so the first history session appears to be session zero, but when you view the history of sessions in the Module Properties > History tab, sessions start at 1, not zero.

I have accounted for this in the code below but perhaps someone could explain why this is so? Is this because by default a loop counter typically starts at zero and there has been some laziness on the part of the author of this loop in the DXL Reference Manual to account for this.
 

HistorySession hs
int sessionNum = 0
for hs in current Module do {
    sessionNum = number(hs) + 1
    print sessionNum ", " when(hs) ", " who(hs) "\n"
    } 
print "The current session number is: " sessionNum""

Paul Miller
Melbourne, Australia

Re: How to identify the DOORS current session number?
Silveirax - Tue May 24 10:43:01 EDT 2011

Thanks, the question was answered.

Re: How to identify the DOORS current session number?
llandale - Tue May 24 13:47:15 EDT 2011

SystemAdmin - Mon May 23 19:35:40 EDT 2011

I should have at least provided you with some code inmy previous post to help you determine what the current session number is, use the code below which is based on an example provided in the DXL Reference Manual.

Some caution here, there seems to be an N+1 issue with the "for hs in current Module do" loop. The initial value of hs starts at 0 so the first history session appears to be session zero, but when you view the history of sessions in the Module Properties > History tab, sessions start at 1, not zero.

I have accounted for this in the code below but perhaps someone could explain why this is so? Is this because by default a loop counter typically starts at zero and there has been some laziness on the part of the author of this loop in the DXL Reference Manual to account for this.
 

HistorySession hs
int sessionNum = 0
for hs in current Module do {
    sessionNum = number(hs) + 1
    print sessionNum ", " when(hs) ", " who(hs) "\n"
    } 
print "The current session number is: " sessionNum""

Paul Miller
Melbourne, Australia

Found that +1 oddity some time ago as well. I don't know the cause but I would guess the conflict is in the GUI, where it reads the session number but displays +1 for all to see; I presume the stored number is zero but it gets displayed as 1.

I see there is this function:

HistorySession hs = current(current Module)

which sadly returns the latest HistorySession, even when the module is opened Read (and therefore should be no 'current' session).

I wonder if this function does what it should:

HistorySession  GetCurrentSession(Module mod)
{    // Get the current Session if the module is opened Edit or Share
     if (null mod or isRead(mod))  //
     then return(HistorySession null)
     else return(HistorySession current(mod))
} // end GetCurrentSession()


I suppose that can be used when plowing through History to determine if a History record was performed in the current Session.

 

 

  • Louie