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: create filter
Topic Summary: How to convert a string to a filter?
Created On: 10-Nov-2005 08:29
Status: Post and Reply
Linear : Threading : Single : Branch
1 2 Next Last unread
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 Reik Schroeder, on Tuesday, March 28, 2006 11:42 AM

Answer:
Hi Paul,
you may be right.
So I've implemented a mainly new solution, which covers the changes made by Richard in a different way ...

I hope, it will work now correctly

Greetings
Reik Schöder
 10-Nov-2005 08:29
User is offline View Users Profile Print this message


Jörg Werner

Posts: 24
Joined: 29-Jul-2005

Hello,

is there any dxl function/script which can convert a string to a Filter?

E.g.:

Filter myfilter = str2filter("(ObjType == R) AND ((Project Relevancy includes ProjectABC) OR (Project Relevancy includes Product))")

  Many thanks, Jörg

Report this to a Moderator Report this to a Moderator
 10-Nov-2005 09:35
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Jörg,

a few month ago I've written such a filterparser.

It is able to retrieve a Filter from a string. The format of string is the same wich can be got from stringOf (Filter, Module).

Please see attached include file ...

I hope, that is, what you need

Greetings
Reik

filterParser.inc
filterParser.inc  (7 KB)



-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 10-Nov-2005 10:44
User is offline View Users Profile Print this message


Ken Mcguffie

Posts: 63
Joined: 3-Feb-2004

Hi Reik,

I cannot download the script. This seems to be a problem with these forums for a lot of people. Would you mind sending me a copy?

Regards

Kenny

kenny.mcguffie@baesystems.com
Report this to a Moderator Report this to a Moderator
 10-Nov-2005 16:25
User is offline View Users Profile Print this message


Jörg Werner

Posts: 24
Joined: 29-Jul-2005

Hi Reik,

this sounds very promising. But I can not download the file.

Can you reply and add the file in a different format, e.g. zip. Or can you send it to joerg.werner@web.de.

    Danke und schönen Gruß, Jörg
Report this to a Moderator Report this to a Moderator
 10-Nov-2005 17:37
User is offline View Users Profile Print this message


Shawn Stepper

Posts: 96
Joined: 6-Aug-2004

Me too please!

Thanks!

Shawn

-------------------------
Shawn Stepper
shawn.e.stepper@wellsfargo.com
Report this to a Moderator Report this to a Moderator
 11-Nov-2005 10:19
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi guys,

here iss the code directly - for copy and paste - I hope this will work well

Greetings
Reik

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 2-Dec-2005 15:10
User is offline View Users Profile Print this message


Richard Good

Posts: 152
Joined: 22-Mar-2005

Hi Reik,

My compliments on a great idea - it saved me a lot of time, but (isn't there always a but) there were a few fairly major bugs in it. These are explained in the attached code. I hope you and others find the attached code useful.

-------------------------
Regards,

Richard Good
Report this to a Moderator Report this to a Moderator
 6-Dec-2005 11:02
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Richard,

sorry for some bugs and thanks for removing

It was the first version of this tool and it can be enhanced somehow ...

One comment to your changes:
It is very nice, that the tool will now parse combinations of more than 2 Elements too. I've implemented it only with 2 parts, because the original Filters (returned by stringOf) are done in the same way. They are placing brackets around each two elements.
Your solution is more comfortable to the user


TNX,
greetings
Reik

P.S.: The attached document contains the documentation of Filter syntax used by Doors and this tool.

Filters.doc
Filters.doc  (77 KB)



-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 7-Dec-2005 10:55
User is offline View Users Profile Print this message


Paul Worrall

Posts: 87
Joined: 30-Sep-2003

The parseFilter function does not seem to follow 'normal' operator precedence rules, for example: in DXL and other programming languages, the boolean expression "A and B or C and D" is evaluated as "(A and B) or (C and D)" whereas parseFilter parses the equivalent filter expression as "((A AND B) OR C) AND D"
Report this to a Moderator Report this to a Moderator
 7-Dec-2005 15:55
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Answer Answer
Hi Paul,
you may be right.
So I've implemented a mainly new solution, which covers the changes made by Richard in a different way ...

I hope, it will work now correctly

Greetings
Reik Schöder




-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany

Edited: 7-Dec-2005 at 16:08 by Reik Schroeder
Report this to a Moderator Report this to a Moderator
 8-Dec-2005 12:40
User is offline View Users Profile Print this message


Richard Good

Posts: 152
Joined: 22-Mar-2005

Nice solution Reik!
This string represents all thats good about internet forums, my compliments to all involved.

-------------------------
Regards,

Richard Good
Report this to a Moderator Report this to a Moderator
 3-Jul-2006 13:29
User is offline View Users Profile Print this message


Jörg Werner

Posts: 24
Joined: 29-Jul-2005

There seems to be another problem with the script:

The following filter does not work:

Release Contains 'E'

It seems that the column name is ignored and the filter

Contains 'E'

is applied.

A quick (and dirty?) fix is to replace

Regexp REcontainsFilter       = regexp "(.*) (CONTAINS|Contains) '(.*)' (.*)"

by

Regexp REcontainsFilter       = regexp "(.*) (CONTAINS|Contains) '(.*)' *(.*)"

   cheers, Jörg

Report this to a Moderator Report this to a Moderator
 10-Aug-2006 11:08
User is offline View Users Profile Print this message


Richard Good

Posts: 152
Joined: 22-Mar-2005

I have some very complicated filters to deal with so have had reason to remove some of the limitations of the previous code (Reik gave me a very good starter for 10). I am adding the code here so others may benefit from it and so that any bugs can be reported (if you use this and find any please report them here I want this to be as bullet proof as possible, excepting that I haven't had time to error trap that conscientiously). The code now copes with NOTs in the middle of the code and brackets in attribute names and enumerations. Hopefully the attachments will work this time.

-------------------------
Regards,

Richard Good
Report this to a Moderator Report this to a Moderator
 10-Aug-2006 20:14
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

All of my filter scripts are done manually, something like the attached.

- Louie
Report this to a Moderator Report this to a Moderator
 11-Aug-2006 08:32
User is offline View Users Profile Print this message


Richard Good

Posts: 152
Joined: 22-Mar-2005

I also use the accept reject technique , but it will not work for some circumstances. I use the attached for running a query (well my version of a query) on a number of doors modules using a filter for the select criteria. It also enables the user to tweak existing filters without having to reconstruct an enormous multi layered filter all over again. In one of my tools they can adjust the string and reapply in seconds.

-------------------------
Regards,

Richard Good
Report this to a Moderator Report this to a Moderator
 13-Oct-2006 16:11
User is offline View Users Profile Print this message


Heather Linsk

Posts: 50
Joined: 7-Mar-2006

Richard -

THANK YOU! THANK YOU! THANK YOU!

You have saved me untold hours of work.

Regards -

Heather Linsk.



-------------------------
Heather Linsk
Lead Engineer
General Dynamics AIS
413-494-7095
Report this to a Moderator Report this to a Moderator
 6-Dec-2006 19:23
User is offline View Users Profile Print this message


Richard Good

Posts: 152
Joined: 22-Mar-2005

There were a couple of bugs in the script concerning brackets in a string, a minor modification was needed. The corrected files are attached. I have edited a line to cope with Object Number.




-------------------------
Regards,

Richard Good

Edited: 22-Feb-2008 at 17:52 by Richard Good
Report this to a Moderator Report this to a Moderator
 21-Nov-2007 18:10
User is offline View Users Profile Print this message


Scott Covington

Posts: 17
Joined: 29-Nov-2004

Reik's dxl appears very useful.

I have seen a different dxl to modify or edit a filter that does not handle regular expressions.
This one appears to handle regular expressions.

The posting appears to only be the core routines to make it work, but no GUI. Before I finish throwing a simple front end on it, has anyone already done it and is willing to share?

I also see that this posting is 2 years old. I'm interested to know if any improvements/fixes have been made in the last 2 years.

thanks,
Scott
Report this to a Moderator Report this to a Moderator
 17-Dec-2007 15:08
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Richard even your version cannot parse a filter that tries to see if an attribute is equal to, greater than, less than, etc. a value that has brackets in it.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 14-Jan-2008 15:39
User is offline View Users Profile Print this message


Richard Good

Posts: 152
Joined: 22-Mar-2005

David,
Please send me the filter that you used to break the tool. The users I support have some fearsomely complicated filters with internal brackets etc all of which parse successfully. It's possible that I have missed some escape character or combination of escape chars that breaks the tool or that other people write filters in a differrent way to the users here. However, I don't propose to revisit this without an example that breaks it. I concede that almost all my filters are based on combinations of strings and enumerates and don't usually throw integers with greater than or less than and brackets in their names into the mix.

-------------------------
Regards,

Richard Good
Report this to a Moderator Report this to a Moderator
Telelogic DOORS » DXL Exchange » create filter

1 2 Next Last unread
Topic Tools Topic Tools
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 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 0 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.