Issue 43156

Summary: Addition to Standard filter
Product: Calc Reporter: alex_rus <cc>
Component: editingAssignee: requirements <requirements>
Status: CLOSED DUPLICATE QA Contact: issues@sc <issues>
Severity: Trivial    
Priority: P3 CC: issues, kami911, kyoshida, niklas.nebel, oc, ooo
Version: 680m79   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: FEATURE Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
improved patch per Eike's comment none

Description alex_rus 2005-02-19 22:40:00 UTC
Hi,
 it will be excellent to add to standard filter the following conditions:
 "begins with", "doesn't begins with", "contains", "doesn't contain", "ends
with", "doesn't ends with" as they are VERY useful and are present in Excel?

Alexander
Comment 1 frank 2005-02-22 10:56:07 UTC
Hi,

IMHO this is covered by the regular expresisons, but let's decide requirements
about this.

Frank
Comment 2 kami911 2005-11-12 07:15:35 UTC
Can you help us?
Comment 3 oc 2005-11-14 07:57:56 UTC
*** Issue 57681 has been marked as a duplicate of this issue. ***
Comment 4 ooo 2005-11-14 15:19:39 UTC
*** Issue 47093 has been marked as a duplicate of this issue. ***
Comment 5 dbadams 2005-11-15 03:01:07 UTC
Alexander,

I concur.  I use the "contain" and "begins with" almost daily in Excel.  I have 
also tried to reproduce them with regular expressions without success.  

Frank,

Please provide guidance to on how to search for a data string using regular 
expressions.
Comment 6 ooo 2005-11-15 11:21:08 UTC
dbadams,

To filter for regular expressions choose condition '=', and in the Value field enter
for "contains":  .*YourSearch.*
for "begins with":  ^YourSearch.*

Note the '.*' dot asterisk expression for "zero or more occurrences of any
character" in both terms, and the '^' circumflex accent that anchors a term to
the start of a paragraph respectively cell content.

To negate a search (does not contain, does not start with) choose the condition
'<>'.

For further information on regular expressions plese see the online help topic
"regular expressions;list of".

  Eike
Comment 7 dbadams 2005-11-16 00:49:51 UTC
Thank you, Eike for the information on wildcard characters / regular 
expressions.  Though the functionality is superior to Excel, it is not as user 
friendly.  I think the biggest issue with me it the filter documentation.  The 
use of regular expressions is not linked or referred to in the OOo help text 
for filters.

Now if you all will excuse me, I am about to go play with the expressions.

Regards,

David (dbadams)
Comment 8 dbadams 2005-11-16 01:25:07 UTC
Eike,

They don't work on standard filters in the filter dialog box.  I tried the 
carat '^', asterisk '*', question mark '?' and period '.' in many combinations 
on a numberic only field and also on an alpha numberic field in a spreadsheet 
table.  No luck.  I checked the box to allow regular expressions before I 
started.  Still, no luck.
Comment 9 dbadams 2005-11-16 01:25:08 UTC
Eike,

They don't work on standard filters in the filter dialog box.  I tried the 
carat '^', asterisk '*', question mark '?' and period '.' in many combinations 
on a numberic only field and also on an alpha numberic field in a spreadsheet 
table.  No luck.  I checked the box to allow regular expressions before I 
started.  Still, no luck.
Comment 10 ooo 2005-11-16 11:02:11 UTC
David,

Regular expressions _do_ work in the standard filter, but just don't match plain
numeric values, which btw is the same for the "starts with" and "contains" in
"the other" spreadsheet application. Alphanumeric _is_ matched. And yes, also
for the filter dialog the online help refers the regular expressions, if you
take a look at the "More>>" section.

If your expressions didn't match it may have been that you entered wildcards
like you're used to with file names, which is not the same as regular
expressions. Note that for "any one character" instead of ? you use . a single
dot, and for "zero or more occurences of any character" instead of * you need to
enter .*

If you need further help with regular expressions please join the
users@openoffice.org mailing list and give examples what exactly didn't work.

  Eike
Comment 11 kami911 2005-11-22 01:36:54 UTC
Can you create other way to starts, ends, contains, empty or not than regular
expression. It is not so user friendly for beginners...
Comment 12 kami911 2006-01-02 05:37:14 UTC
The ximian collection of patches already has a solution. I patched the 2.0.1
source the built on Windows - it works perfectly...
Patch:
http://ooo.ximian.com/patches/src680/sc-standard-filter-options.diff
Comment 13 dbadams 2006-01-02 22:49:15 UTC
Hello Kami,

Thank you for providing the link to Ximian.com.  I went to the web site and 
went through the .diff file and the read me file.  Forgive me, but I cannot 
figure out how to install this patch.  Could you provide step by step 
instructions?  

Thank you,

dbadams
Comment 14 kami911 2006-01-04 20:37:10 UTC
You must have a build system, and you have to rebuild the sc module. I am sad
because I screwed up my build system. I will rebuild it as soon as possible and
build an English and Hungarian build from the latest developer version ...
Comment 15 ooo 2006-01-05 17:29:46 UTC
I took a look at the patch mentioned. I don't like the approach that
SC_BEGINS_WITH and SC_ENDS_WITH force the regular expression flag without the
user knowing. Doing so alters the semantics of the search string and may result
in mismatching results. Instead, if regular expressions are not enabled,
ScTable::ValidQuery() should provide the logic needed.

  Eike
Comment 16 kami911 2006-01-05 17:41:17 UTC
Can you power up this patch with your ideas? And can you force it to be in the
main stream? It would be very useful...
Comment 17 lohmaier 2006-01-11 20:44:22 UTC
*** Issue 60235 has been marked as a duplicate of this issue. ***
Comment 18 ooo 2006-01-16 16:02:17 UTC
Hi Kami,

I won't develop a patch for this right now, but the general idea is that
in ScTable::ValidQuery() the option bMatchWholeCell and SC_BEGINS_WITH
respectively SC_ENDS_WITH are mutually exclusive. So, for example in
case of a non-regex search with SC_BEGINS_WITH, disable bMatchWholeCell
and if searching the query within a cell string matches, test if the
match occured on start of the string. Similar for SC_ENDS_WITH. You get
the idea.

  Eike
Comment 19 kami911 2006-02-10 00:13:14 UTC
Same issue:
http://qa.openoffice.org/issues/show_bug.cgi?id=35579
Comment 20 kyoshida 2006-02-12 16:32:20 UTC
Created attachment 34087 [details]
improved patch per Eike's comment
Comment 21 kyoshida 2006-02-12 16:45:04 UTC
kami_ asked me to look into this.

This new patch improves upon the earlier one submitted by mmeeks, and reflects
Eike's comment.  It works both cases of the regex bit being on and off.  The
dialog class does not force the regex bit to be TRUE when the filter type is
either SC_BEGINS_WITH or SC_ENDS_WIDTH (which I think was a bit un-clean
implementation).  Instead, SC_BEGINS_WIDTH and SC_ENDS_WIDTH differentiate the
regex on and off modes, and act accordingly.  I think it's cleaner this way.

Eike, can you take a look at this patch ? :-)

Kohei
Comment 22 ooo 2006-02-13 17:37:05 UTC
Copied patch to issue 35579 that is older and has more votes. Let's continue there.

*** This issue has been marked as a duplicate of 35579 ***
Comment 23 ooo 2006-02-13 17:44:45 UTC
Closing dup.