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: Compound filter
Topic Summary: Dynamic creation of a filter from multilist
Created On: 1-Oct-2008 09:19
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 Mark Williamson, on Wednesday, October 1, 2008 8:58 PM

Answer:
Thank you everyone for your fantastic guidance and assistance. This forum is a lifesaver for newbies like me where the DXL reference manual is less than useful in many cases.

Through a combination of trial and error and great advice the dxl below seems to be doing what I need. I will of course have to add error trapping etc. But at least it works!

Cheers

Mark
 1-Oct-2008 09:19
User is offline View Users Profile Print this message


Mark Williamson

Posts: 79
Joined: 12-Sep-2005

Hi,

I am trying to write a function which will create a filter using criteria from a multiList listView. I have it working successfully for a single selection but am unsure how to include the multiple selections. Could someone please point me in the right direction. I have thought about using a string array to save all the selections and also a skip. My current effort is attached below. Following application of the filter I then need to copy the object text of all obkects in view to another existing module, but that is another hill to climb!

Thanks

Mark

-------------------------

mark_williamson@synthesys.co.uk
http://www.synthesys.co.uk
----------------------------------------
Report this to a Moderator Report this to a Moderator
 1-Oct-2008 11:55
User is offline View Users Profile Print this message


Mark Williamson

Posts: 79
Joined: 12-Sep-2005

Hi All,

I have managed to loop through the list and populate a buffer with any selected values but is it possible to populate the set (attribute) perm and OR (||) the selections in a filter? I also tried a skip but was only able to extract the key for the selected items.

Thanks

Mark

-------------------------

mark_williamson@synthesys.co.uk
http://www.synthesys.co.uk
----------------------------------------
Report this to a Moderator Report this to a Moderator
 1-Oct-2008 12:06
User is offline View Users Profile Print this message


Pekka Mäkinen

Posts: 276
Joined: 18-Mar-2004

Somewhere I have written (kludge?) code like this:

for o in (current Module) do
{
reject o
for FilterValue in filterFieldDBE do
{
if (isMember(o.FILTER_ATTRIBUTE[0],FilterValue) || isMember(o.FILTER_ATTRIBUTES[1],FilterValue) || isMember(o.FILTER_ATTRIBUTES[2],FilterValue))
{
accept o
}
}
}

Where filterFieldDBE is a multiList and the FILTER_ATTRIBUTE an array containing attribute names used in filtering. Then the DXL reject / accept functions are used to set up a (DXL) filter.

-------------------------
Pekka.Makinen@softqa.fi
SoftQA Oy -http://www.softqa.fi/
Report this to a Moderator Report this to a Moderator
 1-Oct-2008 13:28
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

What kind of filter are you trying to do? Filter on objects where the value of the attribute represented by the multiList is equal to the selection(s) in the multiList?

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 1-Oct-2008 13:44
User is offline View Users Profile Print this message


Mark Williamson

Posts: 79
Joined: 12-Sep-2005

Hi David,

The listView contains a list of attributes with an enumerated data type (1 - 5)

My dialog needs to allow the user to select one or more attributes from the list and along with the enumerated value (1-5) from an additional choiceDBE set a filter on the ref module. I can then copy out the required objects to a new module.

The set ((attribute "a" =="y") works a treat for a single selection. If I run set (attribute "a" =="y") ||set (attribute "b" =="y")) from within the dxl editor in the module, I get the desired result. However I need to be able to build the filter dynamically base upon the user selection.

Does that make sense?? I've been going round in circles for a couple of days on this

Thanks

Mark

-------------------------

mark_williamson@synthesys.co.uk
http://www.synthesys.co.uk
----------------------------------------
Report this to a Moderator Report this to a Moderator
 1-Oct-2008 14:04
User is offline View Users Profile Print this message


Pekka Mäkinen

Posts: 276
Joined: 18-Mar-2004

If you want to create a filter which you want to save in a view, then you must use DOORS filters. Otherwise it is much easier to build complex filters using the reject / accept functions and if you do not need a filtered view to be saved, I would suggest to go this route.

-------------------------
Pekka.Makinen@softqa.fi
SoftQA Oy -http://www.softqa.fi/
Report this to a Moderator Report this to a Moderator
 1-Oct-2008 14:10
User is offline View Users Profile Print this message


Mark Williamson

Posts: 79
Joined: 12-Sep-2005

Thanks Pekka,

I'm willing to try anything at this point. I'm just loooking at your earlier post now.

Mark

-------------------------

mark_williamson@synthesys.co.uk
http://www.synthesys.co.uk
----------------------------------------
Report this to a Moderator Report this to a Moderator
 1-Oct-2008 16:16
User is offline View Users Profile Print this message


Mark Williamson

Posts: 79
Joined: 12-Sep-2005

I've spent this afternoon trying to get the perm

if (isMember(o."my attribute","enum value"))
{
accept o
}

but get the dxl error "expected multi valued attribute"

Am I missing something obvious??

Mark

-------------------------

mark_williamson@synthesys.co.uk
http://www.synthesys.co.uk
----------------------------------------
Report this to a Moderator Report this to a Moderator
 1-Oct-2008 17:11
User is offline View Users Profile Print this message


Mark Williamson

Posts: 79
Joined: 12-Sep-2005

The obvious was that my enumerated data type was not multi value and does not need to be.

Is there an alternative to isMember for single value enums or will I have to amend all the data types to be multi value?

Thank you everyone for all the help and advice.

Mark

-------------------------

mark_williamson@synthesys.co.uk
http://www.synthesys.co.uk
----------------------------------------
Report this to a Moderator Report this to a Moderator
 1-Oct-2008 19:03
User is offline View Users Profile Print this message


Pekka Mäkinen

Posts: 276
Joined: 18-Mar-2004

If it is not multivalued then you should check it like any other attribute attribute value, i.e.

if (o."Attribute Name" "" == Value)

-------------------------
Pekka.Makinen@softqa.fi
SoftQA Oy -http://www.softqa.fi/
Report this to a Moderator Report this to a Moderator
 1-Oct-2008 19:21
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Assuming I'm understanding you right, something like this should build the filter you want.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 1-Oct-2008 20:58
User is offline View Users Profile Print this message


Mark Williamson

Posts: 79
Joined: 12-Sep-2005

Answer Answer
Thank you everyone for your fantastic guidance and assistance. This forum is a lifesaver for newbies like me where the DXL reference manual is less than useful in many cases.

Through a combination of trial and error and great advice the dxl below seems to be doing what I need. I will of course have to add error trapping etc. But at least it works!

Cheers

Mark

-------------------------

mark_williamson@synthesys.co.uk
http://www.synthesys.co.uk
----------------------------------------
Report this to a Moderator Report this to a Moderator
 1-Oct-2008 21:04
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

I thought you wanted to save this filter in a view?

And I see a few things wrong with your code. The biggest one being that you are doing your object loop multiple times. Inside that problem, you are only looping through the current objects. Well as you accept and reject things, the current module changes. So the second time through the object loop, it will only loop through the objects accepted the first time. Finally, move your reject statement to be the else case of your accept if statement.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 1-Oct-2008 21:32
User is offline View Users Profile Print this message


Mark Williamson

Posts: 79
Joined: 12-Sep-2005

Hi David,

I could of course save the filter in a view but I really only want to apply the filter temporarily and then do an object copy on the filtered objects. That function I knopw is going to be a nightmare but one step at a time.
You are absolutely right in that I have restricted the objects in subsequent loops by prior acceptance. I will have to allow for that and recode.

Thanks for your considered review. The learning curve is still steep.

Mark

-------------------------

mark_williamson@synthesys.co.uk
http://www.synthesys.co.uk
----------------------------------------
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.