AutoNumbering of RequirementId in DOORS

Can I increment the RequirementIDs automatically in DOORS. My Requirements Id is an attribute of type integer.
Also this Id should not change in case I insert another Requirement between the two already existing requirements.
E8AS_supriya_verma - Fri May 11 06:47:03 EDT 2012

Re: AutoNumbering of RequirementId in DOORS
PDU - Fri May 11 07:20:17 EDT 2012

Hi,

It is necessary to you to write a script DXL which stores in a dedicated attribute (a module attribute) the last value, and which calculates automatically the identifier for your new requirement.

Another solution is to use "Object Identifier"

Pierre

Re: AutoNumbering of RequirementId in DOORS
lahines - Fri May 11 08:15:40 EDT 2012

If you want a new number whenever you create a new object, you can use a new object trigger. The following script will insert the next highest index number in the new object. This script can probably be improved, but it works for me.
//NewObjectTriggerCreatesIndexNo

/*Initiates trigger that generates the next higher index number. close and reopen module to stop trigger.
Larry Hines
January 2012
*/

Void Current (Trigger trg)
{
Object o = object (trg)
History hst = null
for hst in o do {}
if (!null hst and hst.type == createObject) {

Module m = current
Skip idxkey = create //create skiplist
int absno = o."Absolute Number" //get absolute number of new object so can return later
string oid = null
int idx count = 0, maxindex = 0, idx = 0, n = 0, t = 0

/**************************************Find highest index number*********************/

for o in m do {
idx = o."Index Number"
oid = identifier (o)
put (idxkey, idx, o)
if (idx > maxindex) {maxindex = idx}
}

/**************************************insert next highest index number*************/
maxindex++
filtering off
gotoObject(absno,m)
o=current
n=o."Index Number"
if (n == 0) {
o."Index Number" = maxindex
}

/***************************Clean up ***********************************************/
delet idxkey
}
}
trigger (module->object->all, sync, 10, current) // Dynamic trigger

Re: AutoNumbering of RequirementId in DOORS
PDU - Fri May 11 11:04:54 EDT 2012

lahines - Fri May 11 08:15:40 EDT 2012
If you want a new number whenever you create a new object, you can use a new object trigger. The following script will insert the next highest index number in the new object. This script can probably be improved, but it works for me.
//NewObjectTriggerCreatesIndexNo

/*Initiates trigger that generates the next higher index number. close and reopen module to stop trigger.
Larry Hines
January 2012
*/

Void Current (Trigger trg)
{
Object o = object (trg)
History hst = null
for hst in o do {}
if (!null hst and hst.type == createObject) {

Module m = current
Skip idxkey = create //create skiplist
int absno = o."Absolute Number" //get absolute number of new object so can return later
string oid = null
int idx count = 0, maxindex = 0, idx = 0, n = 0, t = 0

/**************************************Find highest index number*********************/

for o in m do {
idx = o."Index Number"
oid = identifier (o)
put (idxkey, idx, o)
if (idx > maxindex) {maxindex = idx}
}

/**************************************insert next highest index number*************/
maxindex++
filtering off
gotoObject(absno,m)
o=current
n=o."Index Number"
if (n == 0) {
o."Index Number" = maxindex
}

/***************************Clean up ***********************************************/
delet idxkey
}
}
trigger (module->object->all, sync, 10, current) // Dynamic trigger

First a little remark : use (without space inside {..} )
{code }your code {code }, and use tab 'Preview'

I don't see difference between "Absolute Number" and your "Index Number".
I think this code



for o in m 

do 
{ idx = o.
"Index Number" oid = identifier (o) put (idxkey, idx, o) 

if (idx > maxindex) 
{maxindex = idx
} 
}

is not very efficient for big module.
To improve your code, i think you can memorize last highest index number in a module attribute.

Pierre

Re: AutoNumbering of RequirementId in DOORS
lahines - Fri May 11 11:45:40 EDT 2012

PDU - Fri May 11 11:04:54 EDT 2012
First a little remark : use (without space inside {..} )
{code }your code {code }, and use tab 'Preview'

I don't see difference between "Absolute Number" and your "Index Number".
I think this code




for o in m 

do 
{ idx = o.
"Index Number" oid = identifier (o) put (idxkey, idx, o) 

if (idx > maxindex) 
{maxindex = idx
} 
}

is not very efficient for big module.
To improve your code, i think you can memorize last highest index number in a module attribute.

Pierre

The difference is : You can set the Index Number, you cannot set the DOORS absolute number. Of course, you do have to add an "Index Number" attribute in the module. Index number increments (by 1 in this script) from the last index number. Maxnumber++ can be modified to increment by any number. This dxl is driven by initiating a trigger so all "new" objects get an index number and existing numbers are not affected. Using concatenantion, the Index Number can be change to a string value and a prefix added if desired.

Re: AutoNumbering of RequirementId in DOORS
kbmurphy - Fri May 11 18:04:23 EDT 2012

lahines - Fri May 11 11:45:40 EDT 2012
The difference is : You can set the Index Number, you cannot set the DOORS absolute number. Of course, you do have to add an "Index Number" attribute in the module. Index number increments (by 1 in this script) from the last index number. Maxnumber++ can be modified to increment by any number. This dxl is driven by initiating a trigger so all "new" objects get an index number and existing numbers are not affected. Using concatenantion, the Index Number can be change to a string value and a prefix added if desired.

Shareable edit would have dire consequences on this, without doing some major error checking.

Re: AutoNumbering of RequirementId in DOORS
llandale - Sat May 12 16:11:02 EDT 2012

Not sure this is a good idea.

I would be inclinded to have a 'string' Attr-DXL, which is displayed in the views you use to create "requirements". That Attr-DXL would:

bool IsReq = whether the obj is a requirement. 

int  iReqNum = obj.
"ReqNumber"   
// int; default is zero 

if     (iReqNum  > zero and !IsReq) then attrDXL value is some error  
// Non-Req has ReqNum elseif(iReqNum  > zero and  IsReq) then attrDXL value is iReqNum 
""  
// Req already has ReqNum elseif(iReqNum <= zero and !IsReq) then attrDXL value is 
"-"         
// Non-Req has no ReqNum elseif(iReqNum <= zero and  IsReq) then        iReqNum = next un-used ReqNum obj.
"ReqNumber" = iReqNum attrDXL value is iReqNum 
"" 

else
{
}   
// all cases covered

The attrDXL would be the "official" Requirement Number which sets the background "ReqNumber" value once.

As Murphy pointed out, Shared mode creation of Requirements will preclude using a module level attribute to store the "next" reqnumber, so we are pretty much forced to use the find-the-highest-current one method, which may be "ineffecient" but more than a second only for huge modules.

I would consider using the module prefix as a basis for the displayed number:
  • obj.attrDXLName = ((module obj)."Prefix" "")"Req-" iReqNum ""

-Louie

Re: AutoNumbering of RequirementId in DOORS
llandale - Sat May 12 16:19:40 EDT 2012

llandale - Sat May 12 16:11:02 EDT 2012
Not sure this is a good idea.

I would be inclinded to have a 'string' Attr-DXL, which is displayed in the views you use to create "requirements". That Attr-DXL would:


bool IsReq = whether the obj is a requirement. 

int  iReqNum = obj.
"ReqNumber"   
// int; default is zero 

if     (iReqNum  > zero and !IsReq) then attrDXL value is some error  
// Non-Req has ReqNum elseif(iReqNum  > zero and  IsReq) then attrDXL value is iReqNum 
""  
// Req already has ReqNum elseif(iReqNum <= zero and !IsReq) then attrDXL value is 
"-"         
// Non-Req has no ReqNum elseif(iReqNum <= zero and  IsReq) then        iReqNum = next un-used ReqNum obj.
"ReqNumber" = iReqNum attrDXL value is iReqNum 
"" 

else
{
}   
// all cases covered

The attrDXL would be the "official" Requirement Number which sets the background "ReqNumber" value once.

As Murphy pointed out, Shared mode creation of Requirements will preclude using a module level attribute to store the "next" reqnumber, so we are pretty much forced to use the find-the-highest-current one method, which may be "ineffecient" but more than a second only for huge modules.

I would consider using the module prefix as a basis for the displayed number:
  • obj.attrDXLName = ((module obj)."Prefix" "")"Req-" iReqNum ""

-Louie

Oops... "if I have current access to this object then set the ReqNum et tal."

Re: AutoNumbering of RequirementId in DOORS
kbmurphy - Sat May 12 22:26:48 EDT 2012

llandale - Sat May 12 16:19:40 EDT 2012
Oops... "if I have current access to this object then set the ReqNum et tal."

Landale: If multiple people are editing in shareable at the same time, the requirement number is no longer unique. Since DOORS does not update a module in real time in shareable edit, this can't work. Your attrDXL will have to give requirement IDs on open only.

Re: AutoNumbering of RequirementId in DOORS
PDU - Mon May 14 02:36:08 EDT 2012

lahines - Fri May 11 11:45:40 EDT 2012
The difference is : You can set the Index Number, you cannot set the DOORS absolute number. Of course, you do have to add an "Index Number" attribute in the module. Index number increments (by 1 in this script) from the last index number. Maxnumber++ can be modified to increment by any number. This dxl is driven by initiating a trigger so all "new" objects get an index number and existing numbers are not affected. Using concatenantion, the Index Number can be change to a string value and a prefix added if desired.

Hi

Index number increments (by 1 in this script) from the last index number.
"Absolute Number" do the same.

Maxnumber++ can be modified to increment by any number.
This is the only difference between "Absolute Number" and your "Index Number".

This dxl is driven by initiating a trigger so all "new" objects get an index number and existing numbers are not affected.
"Absolute Number" do the same.

Using concatenantion, the Index Number can be change to a string value and a prefix added if desired.
Attribute "Object Identifier" do the same : concatenation of Module attribute "Prefix" and Object attribute "Absolute Number".

Pierre

Re: AutoNumbering of RequirementId in DOORS
lahines - Mon May 14 06:42:29 EDT 2012

kbmurphy - Sat May 12 22:26:48 EDT 2012
Landale: If multiple people are editing in shareable at the same time, the requirement number is no longer unique. Since DOORS does not update a module in real time in shareable edit, this can't work. Your attrDXL will have to give requirement IDs on open only.

Lots of good points and cautions. I work on an isolated system and need to have a method whereby objects and requirements can be synchronized with a second remote isolated system so we have a common reference for requirement changes. The index number, being a attribute field that can be changed, provides that capability, whereas the absolute number is fixed and is determined by the database. With changes occurring on both databases (additions, deletions, rearrrangement) the absolute numbers are quickly out of sync. Restrictions prevent additions by anyone other than a limited group so have not had the problem with duplicates due to DOORS updates mentioned here.

Re: AutoNumbering of RequirementId in DOORS
SystemAdmin - Mon May 14 07:46:56 EDT 2012

lahines - Mon May 14 06:42:29 EDT 2012
Lots of good points and cautions. I work on an isolated system and need to have a method whereby objects and requirements can be synchronized with a second remote isolated system so we have a common reference for requirement changes. The index number, being a attribute field that can be changed, provides that capability, whereas the absolute number is fixed and is determined by the database. With changes occurring on both databases (additions, deletions, rearrrangement) the absolute numbers are quickly out of sync. Restrictions prevent additions by anyone other than a limited group so have not had the problem with duplicates due to DOORS updates mentioned here.

lahines wrote - "....I work on an isolated system....objects and requirements can be synchronized with a second remote isolated system...."

In your particular case, is there a concept that one of these two isolated systems is considered to be the Master repository and the central source of version truth? If yes, maybe there is a simpler way to do this.

Or can changes be submitted, approved and executed in either repository and the other must follow? I would find this odd as it seems to be asking for trouble with basic change control practices, but I've been humbled before.

I've worked in classified isolated environments where there is the concept of Master (customer) and Slave (contractor) DOORS databases that need to be kept in synch. The Master of course dictates the UID applied to module objects where the Object Identifiers in the Master is always copied into a modifiable string attribute which I will call "Master UID". The Object Identifier attribute is excluded from Views, only the "Master UID" attribute is visible

The Slave is initiated via restoring an archive of a known baseline of modules (Formal and Link) from the Master. If the slave wants to add new requirements it has to, by virtue of good config management practices, raise the change as a change request on the owners of the Master. If approved, the Master creates the new object, and the assigned UID at the Master is relayed to the owners of the Slave where they also create the new object but manually enter the UID assigned at the Master into the "Master UID" attribute in the Slave.

All change management is controlled at the Master end - deleted objects, modified objects & new objects - and instructions on how to apply approved change are relayed to the Slave end. It worked quite well as there was only one Master, but still required super tight diligence to ensure synchronization.

Paul Miller
Melbourne, Australia

Re: AutoNumbering of RequirementId in DOORS
lahines - Mon May 14 08:01:02 EDT 2012

SystemAdmin - Mon May 14 07:46:56 EDT 2012
lahines wrote - "....I work on an isolated system....objects and requirements can be synchronized with a second remote isolated system...."

In your particular case, is there a concept that one of these two isolated systems is considered to be the Master repository and the central source of version truth? If yes, maybe there is a simpler way to do this.

Or can changes be submitted, approved and executed in either repository and the other must follow? I would find this odd as it seems to be asking for trouble with basic change control practices, but I've been humbled before.

I've worked in classified isolated environments where there is the concept of Master (customer) and Slave (contractor) DOORS databases that need to be kept in synch. The Master of course dictates the UID applied to module objects where the Object Identifiers in the Master is always copied into a modifiable string attribute which I will call "Master UID". The Object Identifier attribute is excluded from Views, only the "Master UID" attribute is visible

The Slave is initiated via restoring an archive of a known baseline of modules (Formal and Link) from the Master. If the slave wants to add new requirements it has to, by virtue of good config management practices, raise the change as a change request on the owners of the Master. If approved, the Master creates the new object, and the assigned UID at the Master is relayed to the owners of the Slave where they also create the new object but manually enter the UID assigned at the Master into the "Master UID" attribute in the Slave.

All change management is controlled at the Master end - deleted objects, modified objects & new objects - and instructions on how to apply approved change are relayed to the Slave end. It worked quite well as there was only one Master, but still required super tight diligence to ensure synchronization.


Paul Miller
Melbourne, Australia

That is generally how our system works. We use "Index number" in lieu of "Master UID". ASpecs are customer owned and derived specs are contractor owned. Either can initiate changes through a change process, and due diligence keeps them synchronized. Absolute numbers are only used for local reference.

Re: AutoNumbering of RequirementId in DOORS
BillTidy - Tue May 15 11:38:30 EDT 2012

lahines - Mon May 14 08:01:02 EDT 2012
That is generally how our system works. We use "Index number" in lieu of "Master UID". ASpecs are customer owned and derived specs are contractor owned. Either can initiate changes through a change process, and due diligence keeps them synchronized. Absolute numbers are only used for local reference.

The OP has not come back with more exact requirements - I think the replies so far have been overthought. What did the OP ask for or state?

Q1. Can I increment the RequirementIDs automatically in DOORS(?)
A1: Why would you want to? DOORS does this for you automatically - the attribute is 'Absolute Number'.

Constraint1: My Requirements Id is an attribute of type integer.
Answer: This is the type of 'Absolute Number'.

Requirement1: ...this Id should not change in case I insert another Requirement between the two already existing requirements.
Solution1: That is standard DOORS functionality - an 'Absolute Number' is forever.
It appears the OP needs nothing more than standard DOORS functionality.

Re: AutoNumbering of RequirementId in DOORS
llandale - Wed May 16 12:07:44 EDT 2012

kbmurphy - Sat May 12 22:26:48 EDT 2012
Landale: If multiple people are editing in shareable at the same time, the requirement number is no longer unique. Since DOORS does not update a module in real time in shareable edit, this can't work. Your attrDXL will have to give requirement IDs on open only.

I sit corrected.

Odd I forgot that I had this exact situation develop and ended up resolving it by awkwardly keeping the "latest" number in a configFile.

Re: AutoNumbering of RequirementId in DOORS
Bob_Swan - Fri May 18 07:11:48 EDT 2012

BillTidy - Tue May 15 11:38:30 EDT 2012
The OP has not come back with more exact requirements - I think the replies so far have been overthought. What did the OP ask for or state?

Q1. Can I increment the RequirementIDs automatically in DOORS(?)
A1: Why would you want to? DOORS does this for you automatically - the attribute is 'Absolute Number'.

Constraint1: My Requirements Id is an attribute of type integer.
Answer: This is the type of 'Absolute Number'.

Requirement1: ...this Id should not change in case I insert another Requirement between the two already existing requirements.
Solution1: That is standard DOORS functionality - an 'Absolute Number' is forever.
It appears the OP needs nothing more than standard DOORS functionality.

Using the Absolute number is great if you are identifying each object, but you need another attribute, with all the safety controls above if you want to identify requirements specifically, and ignore guidance, information and other waffle in the document.

Re: AutoNumbering of RequirementId in DOORS
PDU - Mon May 21 02:17:28 EDT 2012

Bob_Swan - Fri May 18 07:11:48 EDT 2012
Using the Absolute number is great if you are identifying each object, but you need another attribute, with all the safety controls above if you want to identify requirements specifically, and ignore guidance, information and other waffle in the document.

Hi,

you need another attribute
I think not, you just need not display the value of Absolute Number in the Word exported document.

If you want a specific attribute an other solution :
Requirement ID = Absolute Number if object is a requirement,
empty in other cases.

For example, if "WEXP Template" is the attribute where you define that an object is a "Requirement", you can have a DXL attribut like :



// prevent dxl timeout dialog pragma runLim, 0   Buffer bsz = create   

void endAttributeDXL() 
{ 

if (!

null obj && attrDXLName != 
"") 
{ obj.attrDXLName = richText tempStringOf(bsz) 
}   delete bsz 
}     

void displayRich(string s) 
{ bsz += s bsz += 
"\n" 
}     
//  pragma runLim, 0 

void showIn(Object o, 

int depth) 
{ string s = 

null   string sWexpTemplate = 

null string NomModule = 

null string plain, plainDisp 

int plainTextLen 

int count bool doneOne = 

false string linkModName = 
"*"   sWexpTemplate = probeRichAttr_(o,
"WEXP Template", 

false) 

if (sWexpTemplate == 
"Requirement") 
{ s = probeRichAttr_(o,
"Object Identifier", 

false) displayRich(
"\\pard           " s) 
} 

else 
{ displayRich(
"") 
} 
} showIn(obj,1)     endAttributeDXL()

where "Object Identifier" is the concatenation (by DOORS) of the module attribute "Prefix" and the object attribute "Absolute Number"

Pierre

Re: AutoNumbering of RequirementId in DOORS
BillTidy - Mon May 21 04:28:53 EDT 2012

Bob_Swan - Fri May 18 07:11:48 EDT 2012
Using the Absolute number is great if you are identifying each object, but you need another attribute, with all the safety controls above if you want to identify requirements specifically, and ignore guidance, information and other waffle in the document.

Use attributes to identify the object type (I don't know anyone who is not doing this already) and then filters on that object type to print or view the absolute number or object identifier as the unique id of the requirements. If you need to have the reference numebr of some other tool (outside DOORS) which is the source of data imported to DOORS then use another text attribute and call it something like 'Foreign ID'.
Trying to duplicate the functionality of 'absolute number' for one type of object seems to be total overkill and unnecessarily complex.

Re: AutoNumbering of RequirementId in DOORS
PDU - Tue May 22 01:57:12 EDT 2012

llandale - Wed May 16 12:07:44 EDT 2012
I sit corrected.

Odd I forgot that I had this exact situation develop and ended up resolving it by awkwardly keeping the "latest" number in a configFile.

Hi,

a little question: in shareable edit, is it possible use an module attribute to store "latest" number (instead configFile) ?

more generally, how DOORS manage Module Attributes in shareable mode ?

Pierre

Re: AutoNumbering of RequirementId in DOORS
SystemAdmin - Tue May 22 05:03:23 EDT 2012

PDU - Tue May 22 01:57:12 EDT 2012
Hi,

a little question: in shareable edit, is it possible use an module attribute to store "latest" number (instead configFile) ?

more generally, how DOORS manage Module Attributes in shareable mode ?

Pierre

"....how DOORS manage Module Attributes in shareable mode?..."

Even though Shareable Edit mode disconnects the cascading\inheritance of access rights from the module level down into the Object level, Shareable Edit mode overrides the module level access rights with Read only access. This is to avoid potential data contention issues if two users attempt to edit the same module level attribute at the same time.


Paul Miller
Melbourne, Australia

Re: AutoNumbering of RequirementId in DOORS
PDU - Tue May 22 07:46:43 EDT 2012

SystemAdmin - Tue May 22 05:03:23 EDT 2012
"....how DOORS manage Module Attributes in shareable mode?..."

Even though Shareable Edit mode disconnects the cascading\inheritance of access rights from the module level down into the Object level, Shareable Edit mode overrides the module level access rights with Read only access. This is to avoid potential data contention issues if two users attempt to edit the same module level attribute at the same time.


Paul Miller
Melbourne, Australia

it's very logical,

thanks

Re: AutoNumbering of RequirementId in DOORS
llandale - Tue May 22 09:39:47 EDT 2012

SystemAdmin - Tue May 22 05:03:23 EDT 2012
"....how DOORS manage Module Attributes in shareable mode?..."

Even though Shareable Edit mode disconnects the cascading\inheritance of access rights from the module level down into the Object level, Shareable Edit mode overrides the module level access rights with Read only access. This is to avoid potential data contention issues if two users attempt to edit the same module level attribute at the same time.


Paul Miller
Melbourne, Australia

I offer this different perspective. There is no mechanism to define module-level node as a "shared section" and even if there were, there is no mechanism for "locking" that node, as one would do a normal object in shared mode. Thus access to module level attributes remains "RMDC" or whatever, but you cannot lock it and therefor cannot modify the values.

Having said that, now perhaps someone will use module-level attr-dxl to find a way to prove me wrong.

In any case it would be quite the confusing disaster if someone was editing an object section in shared mode while someone else got module-level access and started creating and deleting or renaming attributes themselves: I change [obj."MyAttr" = "A"], you rename "MyAttr" to "YourAttr" and save and unlock, then I change [obj."MyAttr" = "B"].

-Louie