![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Selected Items from the Database Topic Summary: Created On: 9-Sep-2004 07:09 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
first off, apologies if this has been discussed before, but couldn't see it in the Archives...
A very useful function / ability is to get a list of selected items from the main explorer window - i.e. being able to select one or more Items and then doing something with them. e.g. if you wanted to Baseline or Print a bunch of Modules in one go, it would be nice to have a function which returned a list of them for processing. This was something that a colleague of mine wanted last year & was told by Telelogic, such a function didn't exist... After a bit of poking about the other day ( we needed to be able to get the UID of a broken Module without opening it ) I discovered this little function: Skip selectedItems = getSelectedItems() which returns a list of Items. Attached is a little script which demonstrates its use by displaying info about the selected items. Use === Select some items in the Explorer window & run the script. A list of the items will be presented back via a little GUI. Hope this is of use to others. regards, Dave ///////////////////////////////////////////////////////////////// pragma runLim,0 // globals // constants const string VERSION = "Version 0.1 [DIR ]" const string noItemsMessage = "\nPlease select at least one Item from the Explorer window and then click {\\b Refresh} \n" const string FONT_SIZE = "" const string COLOR_TABLE = "{\\colortbl ;\\red255\\green0\\blue0;\\red0\\green0\\blue255;\\red255\\green128\\blue0;\\red255\\green255\\blue0;}" // colors are Red / Blue / Orange / Yellow //GUI DB smallBox = create("UID of selected Items", styleCentered) DBE infoTextDBE // functions void getInfo(){ Buffer outputBuf = create Skip selectedItems = getSelectedItems() // sneaky undocumented function... Item selectedItem string id, itemType, rootOfItem, nameOfItem bool noItemsSelected = true for selectedItem in selectedItems do{ // loop through the list of selected Items via the Skip noItemsSelected = false // got at least one Item // get required data... id = uniqueID selectedItem nameOfItem = name(selectedItem) itemType = type(selectedItem) rootOfItem = rootName_(selectedItem) if( itemType == "Formal" || itemType == "Descriptive" || itemType == "Link" ) itemType = itemType " Module" // Build output buffer... outputBuf += FONT_SIZE COLOR_TABLE "\n" outputBuf += "{\\b\\ul " nameOfItem "}\n" outputBuf += "Unique ID = {\\b\\cf1 " id "\\cf0} which is directory 'm" id ".mod' in ~/data/v6data/\n" outputBuf += "Item is a {\\b\\cf4 " itemType "\\cf0}\n" outputBuf += "Path = '\\cf2 " rootOfItem "\\cf0 '\n" outputBuf += "\n" } // write out info gathered if( noItemsSelected ) set (infoTextDBE, noItemsMessage) else set (infoTextDBE, stringOf( outputBuf )) // tidy up delete outputBuf delete selectedItems } // end getInfo void getInfo(DB dialogBox){ getInfo() } // end getInfo (d) // front end void createDialogBox() { label(smallBox, VERSION) infoTextDBE = richText(smallBox, "", "", 500, 150, true) apply(smallBox, "Refresh", getInfo) realize smallBox useRTFColour(infoTextDBE, true) // snaz it up getInfo() } // end createDialogBox // main void main(){ createDialogBox() show smallBox } // end main main // recover resources destroy(smallBox) ///////////////////////////////////////////////////////////////// ------------------------- Dave +44 (0)23 9270 5711 david.robbins@astrium.eads.net ~~~~~~~~~~~~~~~~~~~~ EADS Astrium, Anchorage Road Portsmouth. Hampshire. UK PO3 5PU |
|
![]() |
|
![]() |
|
Excellent, this is just what I needed. Thanks for posting!
Andre Quillen Raytheon |
|
![]() |
|
![]() |
|
This is awsome. I've been trying to figure out to interact with the explorer like this. Thanks so much!!!
------------------------- Scott Boisvert Engineering Tools Administrator L-3 Communications - Avionics Systems scott.boisvert@l-3com.com |
|
![]() |
|
![]() |
|
Hi, Dave.
This will do nearly the same: string itemName = "" for itemName in dbExpList do { print itemName " (" type(item(itemName)) ")\n" } "dbExpList" should be an internal list... and print (string get(dbExpTree)) returns the path of the current folder. ------------------------- Dirk Plaschke |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Selected Items from the Database
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.