Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 581027

Summary: Not possible to specify if filters are AND or OR combined
Product: [Technology] NatTable Reporter: Dirk Fauth <dirk.fauth>
Component: GlazedLists ExtensionAssignee: Dirk Fauth <dirk.fauth>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0.3   
Target Milestone: 2.0.4   
Hardware: PC   
OS: Windows 10   
See Also: https://git.eclipse.org/r/c/nattable/org.eclipse.nebula.widgets.nattable/+/196861
https://git.eclipse.org/c/nattable/org.eclipse.nebula.widgets.nattable.git/commit/?id=05475afee9d892a0e1bbf62af1988b9bd62b654c
Whiteboard:

Description Dirk Fauth CLA 2022-11-10 05:55:16 EST
Via the FilterRowConfigAttributes.TEXT_DELIMITER configuration attribute it is possible to set a combined filter, e.g. if the text delimiter is "&" you can enter a filter like "Bart&Lisa" which will filter all Bart and all Lisa. It translates to actually Bart OR Lisa.

For Threshold matchers the behavior is different. If you set for example "> 100 & < 200" it makes an AND condition.

So String matchers are always OR and threshold matchers are always AND. It is not possible to change this. While for String matchers the cases are rare where you would enter an AND (because it can not be Bart AND Lisa for example) it makes a lot of sense for the thresholds, where you would for example also like to have expressions like "< 100 | > 200"

It should be possible to configure that there is a AND and OR support.
Comment 1 Eclipse Genie CLA 2022-11-10 05:56:20 EST
New Gerrit change created: https://git.eclipse.org/r/c/nattable/org.eclipse.nebula.widgets.nattable/+/196861
Comment 3 Dirk Fauth CLA 2022-11-10 06:12:54 EST
It is now possible to specify a two-character regex as delimiter, e.g. "[&\\|]". The first character will be treated as AND and the second parameter will be treated as OR. Using this type of delimiter results in the following:

> 100 & < 200 = greater than 100 AND less than 200
< 100 | > 200 = less than 100 OR greater than 200 

As the pipe is actually also a special character that is treated as OR in a regular expression, there is now also a handling in the filter string parsing that blocks the delimiter.

Bart|Lisa will result in a filter whether there is Bart OR Lisa, but there will be two GlazedLists Matchers because of the split.
(Bart|Lisa) will also result in a filter for Bart OR Lisa, but there will be only on GlazdLists Matcher. And that one will only work if TextMatchingMode.REGULAR_EXPRESSION is configured.
Comment 4 Dirk Fauth CLA 2022-12-14 14:58:11 EST
Released with 2.0.4