Is there a way to get the current Filter?

For many DXL entities, there is a get/set pair.

For Filter I only saw a set.

Is there a way to populate a variable of type Filter with the filtering that is in effect at the moment?

Anyone know what this does and how to use it?
 

getAttributeFilterSettings_(Module, Filter, string&, int&, string&, bool&, bool&);

 


I would like to be able to read the current Filter and be able to modify it and re-apply it in an ad hoc manner. Is this possible?

 


SystemAdmin - Thu Mar 22 16:02:18 EDT 2012

Re: Is there a way to get the current Filter?
Mathias Mamsch - Thu Mar 22 20:20:19 EDT 2012

How about: Filter current ()? Regarding the getAttributeFilterSettings: You probably need to experiment. My guess is, they will give you the settings for a simple filter to be applied, e.g. the first argument the attribute name, the second argument the operator, etc.

There are new perms for DOORS 9 however:
 

Filter getComponentFilter_ (Filter, int index)
int getCompoundFilterType_ (Filter)
string getProperty (Filter, string)
void setProperty (Filter, string key, string value)

 


which probably will allow you to modify compound filters. I did not look at the properties yet however, so at the moment I cannot tell you more. Maybe that helps, regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: Is there a way to get the current Filter?
SystemAdmin - Fri Mar 23 13:52:47 EDT 2012

Mathias Mamsch - Thu Mar 22 20:20:19 EDT 2012

How about: Filter current ()? Regarding the getAttributeFilterSettings: You probably need to experiment. My guess is, they will give you the settings for a simple filter to be applied, e.g. the first argument the attribute name, the second argument the operator, etc.

There are new perms for DOORS 9 however:
 

Filter getComponentFilter_ (Filter, int index)
int getCompoundFilterType_ (Filter)
string getProperty (Filter, string)
void setProperty (Filter, string key, string value)

 


which probably will allow you to modify compound filters. I did not look at the properties yet however, so at the moment I cannot tell you more. Maybe that helps, regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

I overlooked all those overloaded current() functions.

I'll report back on success.

Thanks.

Re: Is there a way to get the current Filter?
SystemAdmin - Fri Mar 23 15:31:48 EDT 2012

Mathias Mamsch - Thu Mar 22 20:20:19 EDT 2012

How about: Filter current ()? Regarding the getAttributeFilterSettings: You probably need to experiment. My guess is, they will give you the settings for a simple filter to be applied, e.g. the first argument the attribute name, the second argument the operator, etc.

There are new perms for DOORS 9 however:
 

Filter getComponentFilter_ (Filter, int index)
int getCompoundFilterType_ (Filter)
string getProperty (Filter, string)
void setProperty (Filter, string key, string value)

 


which probably will allow you to modify compound filters. I did not look at the properties yet however, so at the moment I cannot tell you more. Maybe that helps, regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Mathias, for my specific needs, the below works fine:
 

Filter currentFilter = (Filter current());

 


My objective was to start with a clean slate and have users be able to add a few subtrees to the composite filter.

Once done, users can export (or do something else with) the filtered rows.

The append subtrees algorithm is basically:

For as many subtrees the user desires:

 

 

  • Users selects a subtree
  • If the current filter is null
    • set filter to the subtree
  • Otherwise
    • set the filter = filter || subtree


When you start DOORS there is no filter so it is null. I could not find a way to make the filter null again. I had to kludge an "effective clear". I used the expression

 

 

Filter acceptAllFilter = attribute "Absolute Number" != "-1";



Thereafter when appending subtrees to a filter I actually do:

For as many subtrees the user desires:



 

 

  • Users selects a subtree
  • If the current filter is null
    • set filter to the subtree
  • If the stringOf current filter is "Absolute Number != -1"
    • set filter to the subtree
  • Otherwise
    • set the filter = filter || subtree


Unless you know a more elegant way to clear the filter, I'll call it done.

Thanks again.

 

Re: Is there a way to get the current Filter?
Mathias Mamsch - Fri Mar 23 15:59:19 EDT 2012

SystemAdmin - Fri Mar 23 15:31:48 EDT 2012

Mathias, for my specific needs, the below works fine:
 

Filter currentFilter = (Filter current());

 


My objective was to start with a clean slate and have users be able to add a few subtrees to the composite filter.

Once done, users can export (or do something else with) the filtered rows.

The append subtrees algorithm is basically:

For as many subtrees the user desires:

 

 

  • Users selects a subtree
  • If the current filter is null
    • set filter to the subtree
  • Otherwise
    • set the filter = filter || subtree


When you start DOORS there is no filter so it is null. I could not find a way to make the filter null again. I had to kludge an "effective clear". I used the expression

 

 

Filter acceptAllFilter = attribute "Absolute Number" != "-1";



Thereafter when appending subtrees to a filter I actually do:

For as many subtrees the user desires:



 

 

  • Users selects a subtree
  • If the current filter is null
    • set filter to the subtree
  • If the stringOf current filter is "Absolute Number != -1"
    • set filter to the subtree
  • Otherwise
    • set the filter = filter || subtree


Unless you know a more elegant way to clear the filter, I'll call it done.

Thanks again.

 

Well what would you do in DOORS module to see all objects? Would you define a filter Absolute Number != -1 ? Or would just just turn off filtering. Why would you care that the filter is not 'empty' again? Turn it off, if you care about saving it to a view, just disable it in the viewdef. Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Is there a way to get the current Filter?
SystemAdmin - Fri Mar 23 16:47:44 EDT 2012

Mathias Mamsch - Fri Mar 23 15:59:19 EDT 2012
Well what would you do in DOORS module to see all objects? Would you define a filter Absolute Number != -1 ? Or would just just turn off filtering. Why would you care that the filter is not 'empty' again? Turn it off, if you care about saving it to a view, just disable it in the viewdef. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

The "use case" where this is needed is as follows:

Suppose before a meeting a user wants to export subtrees 2.1.2, 2.1.4, and 2.1.5 as (for example) an HTML document.

In the same session the user wants to export subtrees 3.1.2, 3.1.4, and 3.1.5 as (for example) an HTML document.

When you first go into DOORS, there is no filter so this is fine:
If filter is null

  • filter = subtree expression

Else

  • filter = filter || subtree expression


When you want to do another completely different set of subtrees, you would keep ORing onto the first filter (getting subtrees you no longer want).

Since I could not find a way to clear it, I set aside the pattern below to be a "virtual clear".

So if I see null or the pattern below I set the filter to a subtree expression, otherwise I OR onto the prior filter

The sole purpose of

 

Filter acceptAllFilter = attribute "Absolute Number" != "-1"



is to start fresh again.



 

Re: Is there a way to get the current Filter?
llandale - Mon Mar 26 09:15:13 EDT 2012

SystemAdmin - Fri Mar 23 16:47:44 EDT 2012

The "use case" where this is needed is as follows:

Suppose before a meeting a user wants to export subtrees 2.1.2, 2.1.4, and 2.1.5 as (for example) an HTML document.

In the same session the user wants to export subtrees 3.1.2, 3.1.4, and 3.1.5 as (for example) an HTML document.

When you first go into DOORS, there is no filter so this is fine:
If filter is null

  • filter = subtree expression

Else

  • filter = filter || subtree expression


When you want to do another completely different set of subtrees, you would keep ORing onto the first filter (getting subtrees you no longer want).

Since I could not find a way to clear it, I set aside the pattern below to be a "virtual clear".

So if I see null or the pattern below I set the filter to a subtree expression, otherwise I OR onto the prior filter

The sole purpose of

 

Filter acceptAllFilter = attribute "Absolute Number" != "-1"



is to start fresh again.



 

The following is my understanding of what you are saying, and it seems reasonable.
Your dialog has 2 buttons:
  1. Clear Filter
    • Ignore the current filter and define a new one, AbsNo = -1
  2. Add sub-tree to current filter
    • get the current filter, and "or" it with the sub-tree filter

Alternatively as Mathias suggests, the Clear Filter could just turn filtering(off), and the Add button checks if filtering is on, either creating a new sub-tree filter or "or"ing it with the current filter.

I'd like to point out that the "current" filter has a value even when filtering is off; which gives a slight nod towards Mathias' as it allows the user to "reset" by turning off filtering via the module GUI.

I'm also rather curious as to your sub-tree filter. Perhaps your code requires the user to select the sub-tree and push your button, in which case I think your filter needs to be:
  • get the paragraph "number" of the current object
  • define a filter such that it
    • accepts the object if it exacly matches that paragraph number, or
    • is larger than that paragraph number suffixed with a period and
    • is smaller than that paragraph number+1.
Not sure I said that right. Anyway, the problem comes in because the paragraph numbers are string values yet you want them sorted as integers. If section "2" has 12 sub-sections, their paragraph numbers will sort alphabetically like this: "2.1". "2.10", "2.11", "2.12", "2.2", "2.3" ... "2.9". There was a post some time ago resolving this issue for DXL, but I'm not sure how that would work with a filter.

-Louie

Re: Is there a way to get the current Filter?
SystemAdmin - Tue Mar 27 13:52:29 EDT 2012

llandale - Mon Mar 26 09:15:13 EDT 2012
The following is my understanding of what you are saying, and it seems reasonable.
Your dialog has 2 buttons:

  1. Clear Filter
    • Ignore the current filter and define a new one, AbsNo = -1
  2. Add sub-tree to current filter
    • get the current filter, and "or" it with the sub-tree filter

Alternatively as Mathias suggests, the Clear Filter could just turn filtering(off), and the Add button checks if filtering is on, either creating a new sub-tree filter or "or"ing it with the current filter.

I'd like to point out that the "current" filter has a value even when filtering is off; which gives a slight nod towards Mathias' as it allows the user to "reset" by turning off filtering via the module GUI.

I'm also rather curious as to your sub-tree filter. Perhaps your code requires the user to select the sub-tree and push your button, in which case I think your filter needs to be:
  • get the paragraph "number" of the current object
  • define a filter such that it
    • accepts the object if it exacly matches that paragraph number, or
    • is larger than that paragraph number suffixed with a period and
    • is smaller than that paragraph number+1.
Not sure I said that right. Anyway, the problem comes in because the paragraph numbers are string values yet you want them sorted as integers. If section "2" has 12 sub-sections, their paragraph numbers will sort alphabetically like this: "2.1". "2.10", "2.11", "2.12", "2.2", "2.3" ... "2.9". There was a post some time ago resolving this issue for DXL, but I'm not sure how that would work with a filter.

-Louie

Thanks for your reply.

The means of adding sub-trees is not by typing in a list or presenting a tree GUI. Instead a user places the cursor in a heading and runs a script to "Append Sub-Tree to Filter". Alternately, a user could "Clear Filter".

If filtering is enabled, new headings (not in the sub-tree) will not be selectable.

I know it may seem silly but the idea of setting the filter to "Absolute Number" != "-1" has really an arbitrary means of persisting a state. That state is (from a user perspective) "I have a filter setting but either I made a mistake and want to start again -or- I already used it (e.g., to export a few sub-trees) and want to start fresh. I would prefer to set the filter to null so everything would be more obvious, but I can't find a perm to do it.

So either of these means "start fresh" (use "filter =" to wipe out the old setting):
  • Filter value is null
  • Filter value is "Absolute Number" != "-1"

If any other value is detected, new sub-trees will be appended to the current filter.

Although just turning off filtering seems like the plausible, I can't use the state of filtering one/off to detect user intention because enabling/disabling filtering is reserved for user testing of the filter set (e.g., before I print or export, let's see what I'll be getting). I need some way to sense the difference between user testing of the filter vs. user wants to clear the filter and start again. Since the means is script based, I am simply using "Absolute Number" != "-1" as a flag synonymous with "There is no filter so set rather than append".

Regarding the sorting comment, I have a utility to parse headings, put them in a list of integers organized by level depth a do what you eluded to:
  • new sub-tree is:
    • "Object Number" >= A.B.C AND "Object Number" < "

If a user wants the same filtering over and over again, a view makes more sense. The approach I describe here is for ad-hoc "collection of sub-tree" filtering to limit output to just what you need (save some trees.)

Re: Is there a way to get the current Filter?
SystemAdmin - Tue Mar 27 14:01:45 EDT 2012

llandale - Mon Mar 26 09:15:13 EDT 2012
The following is my understanding of what you are saying, and it seems reasonable.
Your dialog has 2 buttons:

  1. Clear Filter
    • Ignore the current filter and define a new one, AbsNo = -1
  2. Add sub-tree to current filter
    • get the current filter, and "or" it with the sub-tree filter

Alternatively as Mathias suggests, the Clear Filter could just turn filtering(off), and the Add button checks if filtering is on, either creating a new sub-tree filter or "or"ing it with the current filter.

I'd like to point out that the "current" filter has a value even when filtering is off; which gives a slight nod towards Mathias' as it allows the user to "reset" by turning off filtering via the module GUI.

I'm also rather curious as to your sub-tree filter. Perhaps your code requires the user to select the sub-tree and push your button, in which case I think your filter needs to be:
  • get the paragraph "number" of the current object
  • define a filter such that it
    • accepts the object if it exacly matches that paragraph number, or
    • is larger than that paragraph number suffixed with a period and
    • is smaller than that paragraph number+1.
Not sure I said that right. Anyway, the problem comes in because the paragraph numbers are string values yet you want them sorted as integers. If section "2" has 12 sub-sections, their paragraph numbers will sort alphabetically like this: "2.1". "2.10", "2.11", "2.12", "2.2", "2.3" ... "2.9". There was a post some time ago resolving this issue for DXL, but I'm not sure how that would work with a filter.

-Louie

Something I wrote got caught is special sequence hell. Near the bottom it should say:

"Object Number" >= "A.B.C" 
AND 
"Object Number" < "A.B.(C+1)"
// C+1 is computed as an integer and then converted to a string

Re: Is there a way to get the current Filter?
SystemAdmin - Wed Mar 28 05:55:17 EDT 2012

( to 'reset' the current filter ...
i think you can try to load a view without any filter ... then the current filter should be null again.
Feel free to post your code if you are in trouble ;) )