Reputation: 79
I have a project under which there are 50+ formal modules in IBM DOORS,
I want to create a single view for all modules ( As default view ) This view should display all the attributes that are available for that particular module when I open it.
And the number of attributes in some modules vary. If anyone in stack-overflow knows a way on this, It would be really helpful!
Upvotes: 0
Views: 3224
Reputation: 101
Before anything, you should probably be aware that there is a maximum number of attributes that can be loaded into a view. You can check out this thread for more information regarding max columns: https://www.ibm.com/developerworks/community/forums/html/topic?id=1861480b-7aa0-43b2-bf77-be677f5f778e
Now as for how to do this. If you're looking for an automated solution using DXL here's some sample code that you can modify for your purposes. The current code will add object-level attributes that aren't system attributes to the current view of the module you run this code from.
AttrDef ad
Module m = current Module
string sAttrName
int count = 0
Column col
for col in m do {count++}
for ad in m do
{
if ((ad.object) && (!ad.system))
{
sAttrName = ad.name
col = insert (column count)
attribute(col, sAttrName)
width(col, 200)
count++
}
}
Note: This code will only generate a view with all attributes in the module it is run from, it will not loop through all modules in a project or save the view.
To loop through a project and get all modules you'll need to create a recursive function using for itemRef in folder do {...}
. Something like the following:
Folder f = current Folder
void recurseFolder(Folder f)
{
Item iRef
for iRef in f do
{
if (type(iRef) == "Formal")
(call your create views function here with parameter iRef)
else if (type(iRef) == "Folder" || type(iRef) == "Project")
recurseFolder(folder(iRef))
}
}
recurseFolder(f)
And then if you need additional code to save the view, you'll have to add appropriate code for that too using save(View v)
. You can look up additional information pertaining to setting view preferences and saving them in the DXL Reference Manual.
Upvotes: 1