Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Count "shalls" under each Heading in a Module
Topic Summary: Trying to count the number of requirements per Heading
Created On: 14-Mar-2007 19:16
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Paul Tiplady, on Thursday, March 15, 2007 1:20 PM

Answer:
A couple of things:

1. If you have the string 'shall' in a level-1 heading, you'll get a problem with finding the parent (I think...)
2. You might want to iterate back up to the top level heading, depending on your structure. Or even to a heading marked with a particular attribute...
3. Rather than print the heading, create a skip list and an array. Use the skip list to check whether you've seen a heading, and the array to count the number of times you've seen it. The following is pseudo-code, and thus untried! And I can never remember when to use createString instead of create for skips and arrays, so it needs some playing with.

Hope it helps,
Paul.
 14-Mar-2007 19:16
User is offline View Users Profile Print this message


Chris Annal

Posts: 36
Joined: 14-Dec-2005

I think as the need for requirements metrics grows and grows, it would be useful to have a script that simply counts "shalls" that occur under each heading in a module. That way, if the requirements document used as the basis of the DOORS module had sections of requirements such as "Safety" or "Reliability", (which most do), the script would count the number of requirements (shalls) under each of these headings. The result would be usable as a quick count of how many requirements are allocated to "Safety", etc. I have started a simple script that I've attached, which first filters the module so that only those objects with "shall" (whether capitalized or not) appear in the view. Then, it prints out the Heading Text of the object's parent (which is typically the Heading of that section of requirements). I can see from the DXL output that I'm halfway there. That is, for my test module, it would output something like the following:
Safety
Safety
Safety
This lets me know I have 3 Safety requirements, but I want something a little more robust and not so clunky. Is there a way to simply count the number of times the "shall" occurs under a given heading, then start the count over for the next heading in DOORS?
I'm attaching my code (so far) below.
Thanks!!

Chris Annal
chrisa@sensis.com
Report this to a Moderator Report this to a Moderator
 14-Mar-2007 20:03
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Put the heading in a buffer. Then use contains to find each iteration of the word shall. As you find it, delete the already passed text of the buffer. So basically for an object assuming the heading you're speaking of is in the Object Text see code attached. You can also make it more involved and keep track of different kinds of requirements.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com

Edited: 14-Mar-2007 at 20:04 by David Pechacek
Report this to a Moderator Report this to a Moderator
 15-Mar-2007 08:27
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

Answer Answer
A couple of things:

1. If you have the string 'shall' in a level-1 heading, you'll get a problem with finding the parent (I think...)
2. You might want to iterate back up to the top level heading, depending on your structure. Or even to a heading marked with a particular attribute...
3. Rather than print the heading, create a skip list and an array. Use the skip list to check whether you've seen a heading, and the array to count the number of times you've seen it. The following is pseudo-code, and thus untried! And I can never remember when to use createString instead of create for skips and arrays, so it needs some playing with.

Hope it helps,
Paul.

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


Paul dot Tiplady at TRW dot com
TRW Automotive
Report this to a Moderator Report this to a Moderator
 15-Mar-2007 12:50
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

From DXL Reference regarding Skips.
quote:

It is very important, and it is the programmer's responsibility to ensure that data and keys are consistently used when storing and retrieving from a skip list. For example, you can cause program failure by inserting some data into a skip list as an integer, then retrieving the data into a string variable and attempting to print it. The keys used with the skip list can be of any type. However, comparison of keys is based on the address of the key, not its contents. This is fine for elements that are always represented by a unique pointer, for example, objects, modules, or skip lists, but care is needed with strings. This is because a string may not have a unique address, depending on whether it is literal or a computed string stored in a variable. There are two ways of avoiding this problem. The first is to use the createString form of the function for a skip list with a string key. The alternative is to ensure that all literal strings used as keys are concatenated with the empty string.


-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 15-Mar-2007 13:19
User is offline View Users Profile Print this message


Chris Annal

Posts: 36
Joined: 14-Dec-2005

Thanks, Paul. I think I can work with this code. I'm reading up in the DXL Help files in DOORS to familiarize myself more with skip lists and keys, which are somewhat mysterious to me, too, but I'm already able to get some of this working, so finishing it off should be do-able.

Thanks a lot!!
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 2 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.