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: Selection in Multilist
Topic Summary:
Created On: 9-Feb-2007 16:28
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.
Answer This question was answered by David Pechacek, on Friday, February 9, 2007 8:34 PM

Answer:

Before going through your loop to process the selections you could first check which items are selected.


Also.  In your example you say your loop is "for selecteditem in (Array of attributes) do {".  Is this what your loop is?  Because it should be "for selecteditem in yourDBEMultiList do {".  If you're going through your array instead of the multiList thats the problem.

Also I don't recommend doing halts without first getting rid of any dialog boxes on the screen.  I would just do a return statement (make your functions return bools so you can track if there was a problem and exit out if you have nested calls to multiple functions).

The general method to doing what you're trying to do would be to do a "get yourDBEMultiList" into a string (which gets the first selected item if there is one) and see if it equals the empty string( "" ) before going into the loop.  Thats what it sounds like your doing.  That isn't working?

I guess another round-a-bout way of checking if you have a selection is to do the "get yourDBEMultiList" into a string and make sure its length is greater than 0.  If not, output a message and halt.

 9-Feb-2007 16:28
User is offline View Users Profile Print this message


Krishna Kandala

Posts: 170
Joined: 8-Jul-2006

I am working on a code that selects more than one item (attributes of a module) from a multilist and applies the same access rights to these attributes. I have the  following loop which works well when the items are selected in the multilist.

for selecteditem in (Array of attributes) do {
   if (ad.name == selecteditem)  (do something)
}

If no item is selected, I want the code to show that no item is selected and halt the program. I tried using   if(selected item == "")  and if (null selecteditem), but there is no effect. The program runs and does nothing of course.

How can the code sense that no selection is made in the multilist (or list) without resorting to the listView DBE? Is there any callback function that I can run with the code?
 
- Krishna
Report this to a Moderator Report this to a Moderator
 9-Feb-2007 19:36
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Answer Answer

Before going through your loop to process the selections you could first check which items are selected.


Also.  In your example you say your loop is "for selecteditem in (Array of attributes) do {".  Is this what your loop is?  Because it should be "for selecteditem in yourDBEMultiList do {".  If you're going through your array instead of the multiList thats the problem.

Also I don't recommend doing halts without first getting rid of any dialog boxes on the screen.  I would just do a return statement (make your functions return bools so you can track if there was a problem and exit out if you have nested calls to multiple functions).

The general method to doing what you're trying to do would be to do a "get yourDBEMultiList" into a string (which gets the first selected item if there is one) and see if it equals the empty string( "" ) before going into the loop.  Thats what it sounds like your doing.  That isn't working?

I guess another round-a-bout way of checking if you have a selection is to do the "get yourDBEMultiList" into a string and make sure its length is greater than 0.  If not, output a message and halt.



-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com

Edited: 9-Feb-2007 at 19:53 by David Pechacek
Report this to a Moderator Report this to a Moderator
 9-Feb-2007 20:34
User is offline View Users Profile Print this message


Krishna Kandala

Posts: 170
Joined: 8-Jul-2006

Thanks for the reply. In fact I was working with "selecteditem in (multilistDBE)" and not "in array". Otherwise I would have got an error.

The workaround worked well. I missed the function "selected(DBE element, index i)".
Thanks again for  a quick reply.

- Krishna
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.