Greetings, |
Re: Scrolling thru all folders and all projects to export to Excel Do you want excel as the title implies or rtf as you text implies? |
Re: Scrolling thru all folders and all projects to export to Excel OurGuest - Wed Aug 31 07:11:24 EDT 2011 So it is possible to iterate through all projects/modules? Any examples anywhere? If not then I'll figure it out on my own. Many thanks for replying. Cheers, Mike |
Re: Scrolling thru all folders and all projects to export to Excel mike_1973 - Wed Aug 31 08:32:54 EDT 2011 Here is a starting point for you.
//IterateDatabase
/*Demo*/
Project cProject
Module mC
Item itm
bool bForeGround=true, bStandardView=true
void PROCESSMODULE(Module mC)
{ print fullName mC "\n"
//PLACE EXPORTER CALL HERE
//halt
}
void ITERATEDATABASE()
{ for cProject in database do
{ for itm in cProject do
{ if(type itm !="Formal")continue
mC=read(fullName itm,bForeGround,bStandardView)
if(null mC)continue
PROCESSMODULE(mC)
close(mC,false)
}
}
}
ITERATEDATABASE()
|
Re: Scrolling thru all folders and all projects to export to Excel https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14236907#14236907 Mostly it processes module's in their natural Hierarchy and Alpha order (as seen in the Explorer), whereas the "for item in Project" loop processes them in "Item" order, which I think is the order in which each module was created; but anyway looks random. The above is also sensitive to the current Project/Folder giving you more flexibility on which modules to select. Open a folder and run the script and you get the current folder context. You would want to change... this... // Deal with the module here. to..... ExportModule(NameItem) and write that function. Other folks may need to help with the actual export of the module, but I presume it will include opening a particular view, exporting, and saving to a particular file, which has the module name in it, and you will need to make sure that modules with the same name get different file names.
If you want 'Item' order you can change.. this ... { put(skpItems, fullName(itm), itm) to ......{ put(skpItems, itm, itm) |
Re: Scrolling thru all folders and all projects to export to Excel OurGuest - Wed Aug 31 10:08:17 EDT 2011 Here is a starting point for you.
//IterateDatabase
/*Demo*/
Project cProject
Module mC
Item itm
bool bForeGround=true, bStandardView=true
void PROCESSMODULE(Module mC)
{ print fullName mC "\n"
//PLACE EXPORTER CALL HERE
//halt
}
void ITERATEDATABASE()
{ for cProject in database do
{ for itm in cProject do
{ if(type itm !="Formal")continue
mC=read(fullName itm,bForeGround,bStandardView)
if(null mC)continue
PROCESSMODULE(mC)
close(mC,false)
}
}
}
ITERATEDATABASE()
It works...BUT...I get the following error the first time I run it: -R-E- DXL: <Line:1000> null Module parameter was passed into argument position 1 Backtrace: <Line:1031> <Line:1065> -I- DXL: execution halted When I run it again, I don't get the error. However, if I close DOORS and re-open it, I'll again get the error the first time. The error occurs when it reads the module : mC=read(fullName itm,bForeGround,bStandardView) Any ideas? Note that I put noError() before reading the module and I still get the error. Thanks again. |
Re: Scrolling thru all folders and all projects to export to Excel mike_1973 - Wed Aug 31 16:37:20 EDT 2011 If you notice I checked for null module. Also you will notice there are not 1000 lines of code in the script. Change the parameters to read the modules in standard view or open in background. You will need to locate the other name space which is probably a layout dxl in someones default view. |
Re: Scrolling thru all folders and all projects to export to Excel OurGuest - Wed Aug 31 10:08:17 EDT 2011 Here is a starting point for you.
//IterateDatabase
/*Demo*/
Project cProject
Module mC
Item itm
bool bForeGround=true, bStandardView=true
void PROCESSMODULE(Module mC)
{ print fullName mC "\n"
//PLACE EXPORTER CALL HERE
//halt
}
void ITERATEDATABASE()
{ for cProject in database do
{ for itm in cProject do
{ if(type itm !="Formal")continue
mC=read(fullName itm,bForeGround,bStandardView)
if(null mC)continue
PROCESSMODULE(mC)
close(mC,false)
}
}
}
ITERATEDATABASE()
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Scrolling thru all folders and all projects to export to Excel mike_1973 - Wed Aug 31 08:32:54 EDT 2011 The most scalable and fastest way to dump the complete database would be to dump one module at a time from one or more batch jobs, then collect the results to one big file. For an example on how to create a batch job doing an export you can look here: https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14587301� Regards, Mathias Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Scrolling thru all folders and all projects to export to Excel mike_1973 - Wed Aug 31 16:37:20 EDT 2011 Your command "close(mC)" looks suspicious as perhaps the Exporter has closed the module. Since your ProcessModule may be 950 lines long and we can see if its really in this code. You can insert: ... print "Before 'read': " (dxlHere()) "\n" right above your "read" and also your "close" to see their exact line numbers. You could also print the fullName(itm) so you know which module, then open that module manually to see if you get errors. Don't forget to check out the Explorer >Tools menu >Manage Open Modules and close them all, you can expect several invisible "background" modules open. Closing the modules will likely simulate your exiting-restart DOORS symptoms. Generally surround strange code with noError() read.. string ErrMess = lastError() if (!null ErrMess)// then report and bypass else proceed. That code should be short. In this case if your exporter has a "lastError" in there, then it turns it all off and the "close" statement will lack "noError" protection. You want ErrMess to deal with such errors. Failing that then the offending command fails but the code continues, and you'll get an error somewhere else down the line because this command failed. e.g. if "read" fails then your Exporter will generate an error due to the lack of a Module.
|
Re: Scrolling thru all folders and all projects to export to Excel Mathias Mamsch - Wed Aug 31 17:22:38 EDT 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS may fix that; ignoring projects that are subordinate to other projects. |
Re: Scrolling thru all folders and all projects to export to Excel Mathias Mamsch - Wed Aug 31 17:22:38 EDT 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS I realized that the problem was not in the code provided above. I thought that the errors I was getting was due to some other module in DOORS that I don't know about that you guys might have been aware of. Obviously I'm very green in the DOORS world :/. Thanks again, Mike |