<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 12 August 2013 07:38, Kevin Falcone <span dir="ltr"><<a href="mailto:falcone@bestpractical.com" target="_blank">falcone@bestpractical.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Sun, Aug 11, 2013 at 09:23:32AM +0200, Joop wrote:<br>
>    Landon wrote:<br>
><br>
>    Sorry for hijacking your question/thread.<br>
><br>
>      Is there any way to search for tickets while comparing two field values?<br>
>      This doesn't work:<br>
>      Queue = 'Incident Reports' AND Created < CF.{SpecialDate} AND Status = 'new'<br>
>      It doesn't like the string "CF.{SpecialDate}" because it's not enclosed in quotations and<br>
>      therefor not a string.  Which is what I want to do but cannot I guess.  The error displayed<br>
>      on the RT UI is:<br>
><br>
>        Wrong query, expecting a VALUE in 'Queue = 'Incident Reports' AND Created <<br>
>        >CF.{SpecialDate}<--here AND Status = 'new''<br>
><br>
>    I'm looking at something similar. I would like to check whether the ResolvedDate is past the<br>
>    DueDate but that is also not possible. I seem to remember that this has been asked before but<br>
>    can't seem to find that thread anymore. Probably searching with the wrong keywords so if<br>
>    someone can point me in the right direction, please?<br>
<br>
</div></div>Unfortunately, RT's TicketSQL cannot compare two fields like that.<br>
It's hard to free up the engineering time required to make it go<br>
right now.  Hopefully at some point it'll be part of a customer<br>
requirement and that will speed up implementation.<br><br></blockquote><div><br></div><div class="gmail_quote" style="font-family:arial,sans-serif;font-size:13px"><div>OK failing this then perhaps some light can be shed on comparing dates in scrips/modules.  What I envision is an action module that goes through each ticket from this condition:</div>

<div>--search RT::Search::FromSQL "id < 1000000"</div><div><br></div><div>The --action being something like "RT::Action::CreationDates" or something that basically loads the ticket and compares the dates and closes tickets whos CF.{ServerCreated} < Created.  This way any ticket containing an IP address of a server that was created after the ticket was created can be marked resolved.  </div>

<div><br></div><div>The help I need though is on comparing dates using RT::Date or something.  If I load the CF.{ServerCreated} and the Created value how do I compare them reliably in modules?  </div><div><br></div><div>
Would this work?</div>
<div>...<br></div>my $ServerCreated = DateTime::Format::MySQL->parse_datetime( $ticket->FirstCustomFieldValue('ServerCreated') );<br>my $Created = DateTime::Format::MySQL->parse_datetime( $ticketObj->Created );</div>

<div class="gmail_quote" style="font-family:arial,sans-serif;font-size:13px">$ticket->SetStatus( 'resolved' ) if $ServerCreated < $Created;<br></div><div><span style="font-family:arial,sans-serif;font-size:13px">…<br clear="all">

<div><br></div>-- <br><div>Landon Stewart <LandonStewart@Gmail.com><br></div>
</span><br><div><span style="font-family:arial;font-size:small"><br></span></div><div><span style="font-family:arial;font-size:small"><br></span></div></div>
</div></div></div>