Need a DXL script to report object statistics across all modules
Here is the script I am am working with in DOORS 9.6.x:
pragma runLim, 10000
Module m = current
Object o = null
int reqtCount = 0
reqCount=0
load view "Public_FEAT_View"
for o in m do {
reqtCount ++
}
infoBox "There are " reqtCount " matching requirements in Pubic FEAT View"
reqtCount=0
load view "Public_TECH_View"
for o in m do {
reqtCount ++
}
infoBox "There are " reqtCount " matching requirements in Public TECH View"
This script supposedly utilizes views to report back on object counts but I run into errors:
-R-E- DXL: <Line:15> null Module do loop parameter was passed
-I- DXL: execution halted
Line 15 is the first Load view call.
Thanks,
KWITS
|
5 answers
Howard Hsiao (5.5k●1●7)
| answered Jul 12 '15, 11:00 p.m.
JAZZ DEVELOPER edited Jul 12 '15, 11:02 p.m.
Hi Keith,
Instead of using "m=current", which only works if you have a module open AND execute DXL within that module, you can use "m=read(<module-name>)" to load a module on demand before loading one or more views for that module.
You can even have multiple m=read(<module-name>) statements in your DXL to process multiple modules (in a folder or in a project or in the database, etc)
For example
pragma runLim, 10000
Module m
Object o = null
int reqtCount = 0
m=read("AMR Hazards and Risks")
reqCount=0
load view "Public_FEAT_View"
for o in m do {
reqtCount ++
}
infoBox "There are " reqtCount " matching requirements in Pubic FEAT View"
reqtCount=0
load view "Public_TECH_View"
for o in m do {
reqtCount ++
}
infoBox "There are " reqtCount " matching requirements in Public TECH View"
|
Hi Keith,
Have you tried to put the object counting codes into a function?
The following can count the objects in the "Standard view" (or any views) for as many modules as you like. There is no need to close module.
Module m
void countView(string v) {
int reqtCount=0
Object o
load view v
for o in m do {
reqtCount++
}
infoBox "There are " reqtCount " matching requirements in " v
}
m=read("AMR Hazards and Risks")
countView "Standard view"
m=read("AMR Stakeholder Requirements Specification")
countView "Standard view"
m=read("AMR System Requirements Specification")
countView "Standard view"
m=read("Requirements for Reuse")
countView "Standard view"
|
Here is my new script update. This one now works but only when you have opened a formal module and load the script there which defeats my purpose to load multiple views at once and then output the total object counts.
pragma runLim, 10000
//Intialize variables
Module m = current
Object o = null
int reqtCount = 0
if (null m)
{
infoBox("This CETS utility can only be run within a formal module.")
halt
}
//Count total requirement objects for the FEAT Module
reqCount=0
reqtCount=0
load view "Public_FEAT_View"
for o in m do {
reqtCount ++
}
infoBox "There are " reqtCount " matching requirements in Public FEAT View"
//Count total requirement objects for the TECH Module
reqCount=0
reqtCount=0
load view "Public_TECH_View"
for o in m do {
reqtCount ++
}
infoBox "There are " reqtCount " matching requirements in Standard TECH View"
//Count total requriement objects for the BGR Module
reqCount=0
reqtCount=0
load view "Public_BGR_View"
for o in m do {
reqtCount ++
}
infoBox "There are " reqtCount " matching requirements in Public BGR View"
//Count total requirement objects for the SPEC Module
reqCount=0
reqtCount=0
load view "SPEC Public View"
for o in m do {
reqtCount ++
}
infoBox "There are " reqtCount " matching requirements in Standard SPEC View"
Comments You can open a module with the following DXL statement:
m=read(<module-name>)
Please see my answer to this question.
Keith Woodard
commented Jul 13 '15, 8:57 a.m.
Thank you for your post! Here is the code I am testing presently. Wouldn't it accomplish the same thing?
//Count total requirement objects for the FEAT Module
string sModuleFullName = "/IOC/01-Requirements/01-Functional Requirements/FEAT"
Module = module(sModuleFullName)
if (null(mCurr)) {
mCurr = read(sModuleFullName, true,true)
}
reqCount=0
reqtCount=0
load view "Public_FEAT_View"
for o in entire mCurr do {
reqtCount ++
}
infoBox "There are " reqtCount " matching requirements in Public FEAT View"
if (bClose) {
close(mCurr)
}
What is "Module = module(sModuleFullName)" doing there?
It is the same thing.
I suggested to use "read" function with module name as argument to get the module and then use for loop to loop through objects in the module.
You called "read" function with module name as argument with two extra trues to get the module and then use for loop to loop through objects in the module.
Keith Woodard
commented Jul 13 '15, 10:15 a.m.
I agree with your assessment. Your recommendation is more straight-through and it works up to two modules and then I begin to get a null value passed for the next module lookup. I think my problem is now, I need to close each module in the script after the count is rendered.
Keith Woodard
commented Jul 13 '15, 11:38 a.m.
To my knowledge all of my Public Views are identical. However, when I load my third view, I receive this error: "null View parameter was passed into argument position 1". I have checked everything. I have verified the module properties are the same and so are the the views. Only two of my module views will load without error. I have tried calling just the "Standard View" against the other modules all without success. |
Good Day,
Thanks to all of the feedback here, my DXL script is working 100%. I even incorporated an option to output the results to a CSV file and created a toolbar drop-down option to launch the script. It runs from a dummy module called REPORT.
Cheers,
KWITS
|
Hello Howard, Keith,
Please, can you let me know how do I get the requirement count on project level?
Cheers,
Ganesh
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
Where did you run this DXL?
Good Day,