Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Selected Items from the Database
Topic Summary:
Created On: 9-Sep-2004 07:09
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 9-Sep-2004 07:09
User is offline View Users Profile Print this message


Dave Robbins

Posts: 36
Joined: 9-Dec-2003

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
Report this to a Moderator Report this to a Moderator
 7-Sep-2005 20:37
User is offline View Users Profile Print this message


Andre Quillen

Posts: 13
Joined: 10-May-2005

Excellent, this is just what I needed.  Thanks for posting!

Andre Quillen
Raytheon
Report this to a Moderator Report this to a Moderator
 19-Apr-2006 12:40
User is offline View Users Profile Print this message


Scott Boisvert

Posts: 348
Joined: 14-Apr-2006

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
Report this to a Moderator Report this to a Moderator
 19-Apr-2006 14:51
User is offline View Users Profile Print this message


Dirk Plaschke

Posts: 103
Joined: 17-Sep-2002

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
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.