Column number in DXL column's

Hello,

I am writing a DXL column which has to be aware of its column number (or index) to use functions like title(Column c).
Does a variable exist that contains this information when a column DXL is executed in a DOORS view?

Kind regards,
Axel
Axel1 - Thu Sep 30 12:08:42 EDT 2010

Re: Column number in DXL column's
Peter_Albert - Fri Oct 01 03:51:09 EDT 2010

I have the nagging memory that I read somewhere in a related post that a "Column getCurrentColumn()" routine exists in DOORS 9.x, but I might be wrong here.

Anyway, the function below does give you the current column in a layout DXL, but you have to prepare is as follows to work: The identification of the column is achieved by a string identifier which you have to

a) specify in a comment at the top of the layout DXL; and
b) use in the function call.

An example layoutDXL would look like this:

// GetColumnExample
#include <../layout/include/getCurrentColumn.inc>
Column col = getCurrentColumn("GetColumnExample")
if (!null col){display title(c) ""}

.

Here is the include file:
 

// Get a handle to the current column
/*
Layout DXL does not have a mechanism for getting e.g. the current
column title. This subroutine can be used for getting a handle to the
current column

USAGE: The column must of course be a layoutDXL column. The first line of
code must be a comment containing a user-defined unique identifier. The
same identifier must be used as parameter in the call to 
Column getCurrentColumn(string thisIdentifier)

EXAMPLE:
// GetColumnExample
#include <../layout/include/getCurrentColumn.inc>
Column col = getCurrentColumn("GetColumnExample")
if (!null col){display title(c) ""}

*/
// -----------------------------------------------------------------
int getCurrentColumn(string thisIdentifier)
{ // Return the index of the current column
  int returnValue = -1
  int iCol = -1
  Column c
  string thisDXL
  bool columnFound = false
  int l
  for c in current Module do
  { // Loop through columns
    iCol++
    thisDXL = dxl(c)
    if (null thisDXL){continue}
    l = length(thisIdentifier)
    // Try '//Identifier'
    columnFound = thisDXL[2:l+1] == thisIdentifier
    if (!columnFound)
    { // Try '// Identifier'
      columnFound = thisDXL[3:l+2] == thisIdentifier
    } // Try '// Identifier'
    if (columnFound)
    { // Matching column found
      returnValue = iCol
      break
    } // Matching column found
  } // Loop through columns
  return returnValue
} // Return the index of the current column
// -----------------------------------------------------------------
Column getCurrentColumn(string thisIdentifier)
{ // Return a handel to the current column
  Column returnValue
  int n = getCurrentColumn(thisIdentifier)
  if (n >= 0){returnValue = column n}
  else {returnValue = null}
  return returnValue
} // Return a handel to the current column

 


Regards,

Peter

 

Re: Column number in DXL column's
SystemAdmin - Fri Oct 01 04:07:40 EDT 2010

Peter_Albert - Fri Oct 01 03:51:09 EDT 2010

I have the nagging memory that I read somewhere in a related post that a "Column getCurrentColumn()" routine exists in DOORS 9.x, but I might be wrong here.

Anyway, the function below does give you the current column in a layout DXL, but you have to prepare is as follows to work: The identification of the column is achieved by a string identifier which you have to

a) specify in a comment at the top of the layout DXL; and
b) use in the function call.

An example layoutDXL would look like this:

// GetColumnExample
#include <../layout/include/getCurrentColumn.inc>
Column col = getCurrentColumn("GetColumnExample")
if (!null col){display title(c) ""}

.

Here is the include file:
 

// Get a handle to the current column
/*
Layout DXL does not have a mechanism for getting e.g. the current
column title. This subroutine can be used for getting a handle to the
current column

USAGE: The column must of course be a layoutDXL column. The first line of
code must be a comment containing a user-defined unique identifier. The
same identifier must be used as parameter in the call to 
Column getCurrentColumn(string thisIdentifier)

EXAMPLE:
// GetColumnExample
#include <../layout/include/getCurrentColumn.inc>
Column col = getCurrentColumn("GetColumnExample")
if (!null col){display title(c) ""}

*/
// -----------------------------------------------------------------
int getCurrentColumn(string thisIdentifier)
{ // Return the index of the current column
  int returnValue = -1
  int iCol = -1
  Column c
  string thisDXL
  bool columnFound = false
  int l
  for c in current Module do
  { // Loop through columns
    iCol++
    thisDXL = dxl(c)
    if (null thisDXL){continue}
    l = length(thisIdentifier)
    // Try '//Identifier'
    columnFound = thisDXL[2:l+1] == thisIdentifier
    if (!columnFound)
    { // Try '// Identifier'
      columnFound = thisDXL[3:l+2] == thisIdentifier
    } // Try '// Identifier'
    if (columnFound)
    { // Matching column found
      returnValue = iCol
      break
    } // Matching column found
  } // Loop through columns
  return returnValue
} // Return the index of the current column
// -----------------------------------------------------------------
Column getCurrentColumn(string thisIdentifier)
{ // Return a handel to the current column
  Column returnValue
  int n = getCurrentColumn(thisIdentifier)
  if (n >= 0){returnValue = column n}
  else {returnValue = null}
  return returnValue
} // Return a handel to the current column

 


Regards,

Peter

 

Checking through DOORS 9.3 doors.exe I found the function "Column currentColumn", so slightly modifying you example works:
 

Column col = currentColumn
if (!null col){display title(col) ""}

Re: Column number in DXL column's
Axel1 - Fri Oct 01 04:40:56 EDT 2010

Peter_Albert - Fri Oct 01 03:51:09 EDT 2010

I have the nagging memory that I read somewhere in a related post that a "Column getCurrentColumn()" routine exists in DOORS 9.x, but I might be wrong here.

Anyway, the function below does give you the current column in a layout DXL, but you have to prepare is as follows to work: The identification of the column is achieved by a string identifier which you have to

a) specify in a comment at the top of the layout DXL; and
b) use in the function call.

An example layoutDXL would look like this:

// GetColumnExample
#include <../layout/include/getCurrentColumn.inc>
Column col = getCurrentColumn("GetColumnExample")
if (!null col){display title(c) ""}

.

Here is the include file:
 

// Get a handle to the current column
/*
Layout DXL does not have a mechanism for getting e.g. the current
column title. This subroutine can be used for getting a handle to the
current column

USAGE: The column must of course be a layoutDXL column. The first line of
code must be a comment containing a user-defined unique identifier. The
same identifier must be used as parameter in the call to 
Column getCurrentColumn(string thisIdentifier)

EXAMPLE:
// GetColumnExample
#include <../layout/include/getCurrentColumn.inc>
Column col = getCurrentColumn("GetColumnExample")
if (!null col){display title(c) ""}

*/
// -----------------------------------------------------------------
int getCurrentColumn(string thisIdentifier)
{ // Return the index of the current column
  int returnValue = -1
  int iCol = -1
  Column c
  string thisDXL
  bool columnFound = false
  int l
  for c in current Module do
  { // Loop through columns
    iCol++
    thisDXL = dxl(c)
    if (null thisDXL){continue}
    l = length(thisIdentifier)
    // Try '//Identifier'
    columnFound = thisDXL[2:l+1] == thisIdentifier
    if (!columnFound)
    { // Try '// Identifier'
      columnFound = thisDXL[3:l+2] == thisIdentifier
    } // Try '// Identifier'
    if (columnFound)
    { // Matching column found
      returnValue = iCol
      break
    } // Matching column found
  } // Loop through columns
  return returnValue
} // Return the index of the current column
// -----------------------------------------------------------------
Column getCurrentColumn(string thisIdentifier)
{ // Return a handel to the current column
  Column returnValue
  int n = getCurrentColumn(thisIdentifier)
  if (n >= 0){returnValue = column n}
  else {returnValue = null}
  return returnValue
} // Return a handel to the current column

 


Regards,

Peter

 

Thanks a lot Peter, it works in DOORS 8.1.
Just a slight correction in the Layout DXL:

// GetColumnExample
#include <../layout/include/getCurrentColumn.inc>
Column col = getCurrentColumn("GetColumnExample")
if (!null col){display title( col ) ""}

Kind regards,
Axel

Re: Column number in DXL column's
Axel1 - Fri Oct 01 04:46:17 EDT 2010

SystemAdmin - Fri Oct 01 04:07:40 EDT 2010

Checking through DOORS 9.3 doors.exe I found the function "Column currentColumn", so slightly modifying you example works:
 

Column col = currentColumn
if (!null col){display title(col) ""}

Thank you for your help Pekka. I tried it in DOORS 9.1 and the function already exists.

Kind regards,
Axel