Question & Answer
Question
How do I count the number of occurences of the words like "shall", "must", and "will" in my Rational DOORS requirements module?
Answer
This can be done by running a script on the DOORS module to automate the task. Please follow the steps below:
1. Login to DOORS.
2. Open the concerned DOORS module, click on Tools -> Edit DXL.
3. Paste the script in the editor window:
//DXL code:
Object o
string s = null
string r = null
string t = null
string x = null
string y = null
string z = null
int count = 0
int countw = 0
int countz = 0
int sc = 0 // shallcount integer
int wc = 0 // willcount integer
int mc = 0 // mustcount integer
for o in current Module do{
Regexp line = regexp "shall"
x = o."Object Text"
while (!null x && line x) {
s = x[match 0] "\n"
++count
x = x[end 0 + 2:] // move past newline
}
sc=sc+count
count = 0
}
print "Number of shalls in module is " sc "\n"
for o in current Module do{
Regexp line = regexp "will"
y = o."Object Text"
while (!null y && line y) {
r = y[match 0] "\n"
++countw
y = y[end 0 + 2:] // move past newline
}
wc=wc+countw
countw = 0
}
print "Number of wills in module is " wc "\n"
for o in current Module do{
Regexp line = regexp "must"
z = o."Object Text"
while (!null z && line z) {
t = z[match 0] "\n"
++countz
z = z[end 0 + 2:] // move past newline
}
mc=mc+countz
countz = 0
}
print "Number of musts in module is " mc "\n"
4. Click on Run. An hour-glass is displayed when the script runs. Once the script has finished executing, the hour-glass goes away. Close the DXL editor window.
All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
---|
Was this topic helpful?
Document Information
Modified date:
01 May 2020
UID
swg21399194