Page 1 of 1

Solution to problem in filter using "matches" expr

Posted: Wed Nov 12, 2008 12:54 pm
by reaton
:D FYI.... I was having problems when I used the "matches" expression in filters. For example: I set PurgeWhenFull filter to only delete <Name><matches><Event> because if I renamed an event, I probably wanted to keep it. However, the matches clause would cause a sql error. I fixed the error by adding single quotes around the $value variable in filter.pl.

Changed from this:

Code: Select all

if ( $filter_terms{$op_name} eq '=~' )
                                {
                                        $filter_sql .= " regexp $value";
                                }
                                elsif ( $filter_terms{$op_name} eq '!~' )
                                {
                                        $filter_sql .= " not regexp $value";
Changed to this:

Code: Select all


if ( $filter_terms{$op_name} eq '=~' )
                                {
                                        $filter_sql .= " regexp '$value'";
                                }
                                elsif ( $filter_terms{$op_name} eq '!~' )
                                {
                                        $filter_sql .= " not regexp '$value'";
I thought that I could place single quotes around the <Event> text in the filter window but this would not work. I found that I had to place the quotes in the PERL script.

Posted: Fri Nov 14, 2008 6:51 am
by kingofkya
you do realize there is an archive function that will save events until you delete with out your creative query

on top of event window there is a button called archive

Posted: Fri Nov 14, 2008 11:38 am
by reaton
kingofkya wrote:you do realize there is an archive function that will save events until you delete with out your creative query on top of event window there is a button called archive...
Yes, I know this. In fact my PurgeWhenFull filter has a condition of 'NotArchived', however I set the 'creative query' condition because if I saw an event and changed the name but did not archive it, the event won't be deleted. Sort of a failsafe for not deleting important events.