[Rt-devel] Trouble adding text value with no quotes in query builder

Michael Gilbert mdgilb at u.washington.edu
Wed Jun 28 15:07:39 EDT 2006


Hello,

I'm having a little problem that I can't seem to find the solution for.  
What I'd like to do is add the ability to create a query in Query 
Builder where the field is a date type (specified in 
/Elements/SelectDateType) and the value is or is not null (I also 
updated /Elements/SelectDateRelation with a 'Not On' relation which has 
a value of "IS NOT").

The idea is that I would be able to create a query along the lines of 
'select * from tickets where Told is NULL;' in order to retrieve tickets 
that have not been responded to.  One requirement of this is that the 
NULL value can not be surrounded by quotes or the query will fail.  So I 
added an exception to where the quotes are added in Search/Build.html 
(including a small chunk, for me the changed line is 544):

                # It has to be this way until #5182 is fixed
                $value = "'NULL'";
            }
            else {
                ## UW - not quoting if the value is NULL
                $value = "'$value'" unless $value eq 'NULL';     #### 
<------
            }
            my $clause = {
                Key   => $keyword,

Now, before the quotes were removed the query could be added to and 
saved, but it wouldn't return results because it just wasn't valid.  But 
now the statement can be successfully added to a new or existing query, 
but when I try to add another statement or save the query the 
'<datetype> <operator type> NULL' line gets removed from the existing 
query.  I've looked at this for awhile and can't find out exactly why 
this portion of the query refuses to be saved.  Does anyone know of a 
reason that unquoted text can't be saved in a query?  I imagine I'm 
missing something simple (possibly in Tree.pm?), but can't find it.

I'd appreciate any suggestions.  Thanks,

Michael Gilbert
SSG, University of Washington


More information about the Rt-devel mailing list