![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Filtering on part of a specific text attribute Topic Summary: Created On: 12-Feb-2003 15:33 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I want to build a filter using DXL which selects all text attributes that include a certain string, eg Object Text which includes "shall". This is used to gather metrics so that several filters can be fired off sequentially and the metrics gathered.
The problem is if I use the attribute (value) function I seem to be limited to seaching for complete attribute strings. If I use the contents function, I can filter using part of the text but in any text attribute. What am I missing in order to search a specific attribute for those objects that contain a given text string? I can be done using the filter tool so why not in DXL? Many Thanks. |
|
![]() |
|
![]() |
|
Unfortunately, I haven't found a dxl command equivalent to the filtering on the contents of a single attribute using regular expressions functionality that is available from the user interface.
The attached code is an example of how it is usually done from DXL. If you are only searching a single specific attribute, you will need to uncomment the ( if ad.name "" == "My Attribute Name" ) check (including the trailing brace) and fill in the attribute name you are checking for. ------------------------- Michael Sutherland michael@galactic-solutions.com http://galactic-solutions.com |
|
![]() |
|
![]() |
|
Be advised that Sutherland's code does NOT "define" a filter, it just runs one (notice that it evaluates each object and either accepts or rejects it). You cannot save this filter as part of a View. You will need to execute his code everytime you want to see the filter results. Nothing wrong with that; all of my 15 or so filter DXLs work the same way.
- Louie |
|
![]() |
|
![]() |
|
Michael Sutherlands approach is fine. I am only using the filter as a means to gather the metrics and so it might form a useful new approach to the whole problem.
Many thanks Peter Edited: 13-Feb-2003 at 09:01 by Peter Seager |
|
![]() |
|
![]() |
|
I was looking for providing similar functionality, but I needed to also save the filter definition into a view. A call to Telelogic tech support eventually provided an answer from which I inferred the following function definition:
Filter contains(attribute_handle attribute, string text[, bool caseSensitive]) As an example, running the following code from a module: Module m=current Filter f=contains(attribute "Object Text", "[sS]hall") set(f) print stringOf(m, f) "\n" will print: Object Text CONTAINS '[sH]hall' [with regexps] By using the optional caseSensitive argument and modifying the search criteria so that it does not reference a regular expression, you will get Object Text CONTAINS 'shall' (caseSensitive=false) or Object Text Contains 'shall' (caseSensitive=true) The net result is a filter which can be created via DXL and saved with any view. -Dennis |
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.