![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Looping Modules within a Project Topic Summary: Created On: 5-Nov-2002 15:33 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: You almost have it right, but you have to loop through the project you want, but you have to open each formal module, if you want to look inside of it. Declare an Item and loop on that Item, then check if that Item is a Formal Module, if it is open it if needed and do what ever you have to do. if you are outputting data to a file, it might be easier to set your format up and store it all into a text buffer, then output the buffer to a file when done looping through the project. Then delete the buffer. You only then have to output once instead for every module you open. Module m Item i string itemType string temp for i in current Project do { itemType = type i if( itemType == "Formal") { temp = fullName(i) m = read(temp,false) } } | |
![]() |
|
Does anybody know what is the magic syntax to get good results while looping through a project? The code I have in the attachment does the job only for one module. I had unsuccessfully tried different combinations and I am running short on ideas. I will appreciate all good suggestions. Thank you, Doina
![]() |
|
![]() |
|
![]() |
|
Doors seems to not support this functionality to well.
I haven't been able to get it to assign a project to a variable so I can loop through the modules within the project. Anyone have any success? Seems like it should be simple. To loop through modules I eventually moved them to the top level of the project (not within a subfolder) and then my script worked. I had to then loop through each module's attributes, setting inheritance of those ending in "_Delivery" to false.... string AdNameStr string AdNameStrRt string AdNameStrLt int i AttrDef ad string modName Module m_target for modName in current Project do { m_target =edit (modName, true) print (modName "\n") for ad in m_target do { //print "Attribute: " ad.name "\n" /*Skip nrinprefix = create put(nrinprefix, 1,1) put(nrinprefix, 2,2) put(nrinprefix, 3,3) put(nrinprefix, 4,4) for each i in nrinprefix do { */ for i in 0:5 do { AdNameStr= ad.name AdNameStrRt= AdNameStr[i:] //print AdNameStr"\n" if (AdNameStrRt == ("_Delivery")) { ad = modify(ad, setInherit, false) print ("Modified " AdNameStr "\n") } } //1 to 4 } //ad in module save(m_target) close(m_target) }//modules in proj Rob |
|
![]() |
|
![]() |
|
You almost have it right, but you have to loop through the project you want, but you have to open each formal module, if you want to look inside of it.
Declare an Item and loop on that Item, then check if that Item is a Formal Module, if it is open it if needed and do what ever you have to do. if you are outputting data to a file, it might be easier to set your format up and store it all into a text buffer, then output the buffer to a file when done looping through the project. Then delete the buffer. You only then have to output once instead for every module you open. Module m Item i string itemType string temp for i in current Project do { itemType = type i if( itemType == "Formal") { temp = fullName(i) m = read(temp,false) } } |
|
![]() |
|
![]() |
|
Delisi is correct. The keys are
1) Using the "for item in project" loop, and 2) getting the FULLNAME of the item. - Louie |
|
![]() |
|
![]() |
|
Cool, thanks for solving this one!
Rob |
|
![]() |
|
![]() |
|
Well, I think Telelogic knows how to do this, but not here, only for a good consulting fee. I am still struglling with this. Fullname will give you the module full path. I am really not after this. The trick will be to get DXL to count what the program needs. Thanks for reducing my frustration level.
|
|
![]() |
|
![]() |
|
Module short (unqualified) names are virtually useless except for output display purposes:
o You cannot find it if its not in the "current" folder o You open a full can of worms if there is more than one module with the same name in the project. What are you going to do with a module called "DOORS Links"? Which one? This also means there are several DXL calls that are likewise useless, such as "for all sources" of incoming links or getting the "target" name of a link. FullNames and Module handles (and I guess Modules Unique IDs) are the only way to keep track of modules in DXL. Even Unique IDs falls apart if you are storing this information for later retrieval, since archive/restore resets these IDs, thus destroying such things as your Layout Impact/Trace wizard columns. Do yourself a favor and deal exclusively with full module names. - Louie |
|
![]() |
|
![]() |
|
Louie, I got past the link modules: << if (m_type != "Formal") continue>>. Doina
|
|
![]() |
|
![]() |
|
I am trying to loop within Change Proposal System folder for each project, to get information of those Proposal modules. I met the difficulty in doing this.
Any help is highly appreciated!!!! Here is my code: string projectName for projectName in database do { string mess = openProject(projectName) Project p = current Project string s = name (p) print s ": " "\n" Item i string itemType string temp for i in p do { itemType = type i if(itemType == "Folder") { temp = fullName(i) string temp2 = name(i) if(cistrcmp(temp2,"Change Proposal System")==0) { print temp "\t" I am trying to get module infor within this folder, I met the difficulty } } } print "\n\n" closeProject() } |
|
![]() |
|
![]() |
|
Try the code below. Doina
//metric.dxl //Created on 10/08/02 //Created by Doina Scafaru //This program will return: /* Module name, date Number of requirements Number of TBD(s) Number of requirements without all of the verification attributes defined Number of Requirements that have completed verification */ #include <N:/Win/Doors/lib/dxl/addins/As_cps/locstring.inc> int numreq = 0 int numdone = 0 //Complete int numpln = 0 //no plans string pln string req int ckflg string tst string tbd = "TBD" int numtbd = 0 string ready bool fflg int fidx int oidx int numotxt = 0 int numcue = 0 //plans defined int numst = 0 pragma runLim,0 filtering off Object p Object o Module m = current string filename = "C:/Modulemetrics.csv" for o in m do { //Calculate the total number of requirements req = o."Requirement ?" if (req == "Yes") ++numreq //Verify text TBDs tst = o."Object Text" if (tst != null) { ++numotxt fflg = true oidx = 0 lentxt = length(tst) while ((oidx < lentxt) && (fflg)) { locstring(tbd,tst,fidx,fflg) if (fflg) { ++numtbd ++fidx tst = tst[fidx:lentxt-1] oidx = oidx + fidx } // End if (fflg) } // End while ((oidx < lentxt) && (fflg)) } // end if (tst != null) // Verify Level List if ((o."Verification Level" == null) && (req == "Yes")) ++numpln if ((o."Verification Level" != null) && (req == "Yes")) ++numcue //Verify Status List ready = o."Verification Status" if (ready == "Complete") ++numdone } // Write the metrics data to a file string modname = m."Name" Stream output = write filename output << "\t\t\t Module : " modname "\n" output << "\t\t\t Date : " today "\n\n" output << "Total number of requirements per module: " numreq "\n\n" output << "Number of TBDs : " numtbd "\n\n" output << "Number of requirements that have verification plans defined: " numcue "\n\n" output << "Number of requirements without verification plans defined: " numpln "\n\n" output << "Number of requirements that have completed verification: " numdone "\n\n" ack "The module metrics report is complete. \nThe report is located in C:/Modulemetrics.csv" /*DB createDB = create "Metric Report Results" DBE metricrepDBE = field(createDB, "Total number of requirements per module: ", "", 5, true) DBE descriptionDBE = field(createDB, "Number of TBDs: ", "" , 5, true) DBE definedDBE = field(createDB, "Number of Reqs with verification plans defined:", "", 5, true) DBE noplnDBE = field(createDB, "Number of Reqs without verification plans: ", "", 5, true) DBE nocompletedDBE = field(createDB, "Number of Reqs that completed verification: ", "", 5, true) show createDB*/ //end dxl |
|
![]() |
|
![]() |
|
Doina, I got it. Thank you all very much!!!
|
|
![]() |
|
![]() |
|
Doina is it possible to post the appropriate include file (locstring.inc) here.
If not, could you provide it please to my mail address? Thank you Hendrik Grapt |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Looping Modules within a Project
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.