<div dir="ltr">Hi Alex,<div><br></div><div>I found the cause of this issue. It's not a problem with "midnight Sunday" or something, it is about the Custom Field. I set the build-in Starts date to "Proposed Start Time(GMT)", then run "Queue = 'ChangeRequest' AND Status != 'Closed' AND Starts > 'midnight Sunday before last' ", it returns the expected results. But when I change Starts to "'CF.{Proposed Start Time(GMT)}'", it returns nothing.</div><div><br></div><div>Does 'CF.{Proposed Start Time(GMT)}' return a datetime value? Or, how can I set Starts and Due date in scrip?</div><div><br></div><div>Please help on these questions, thank a lot!</div><div><br></div><div><br></div><div>Br</div><div>Vodar</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Sep 4, 2014 at 4:53 AM, 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"><span class="">On Wed, Sep 03, 2014 at 04:40:04PM +0800, Chrilly Cheng wrote:<br>
> Hi Alex,<br>
> <br>
> Thanks a lot for your explanation. I've done that config to set <br>
> $AmbiguousDayInPast to 1, but the query still not work. I changed it a little<br>
> bit:<br>
><br>
> Queue = 'ChangeRequest' AND ( Status = 'InProgress' Or Status =<br>
> 'WaitingforApproval' ) AND 'CF.{Proposed Start Time(GMT)}' > 'midnight Sunday'<br>
> AND 'CF.{Proposed Start Time(GMT)}' < 'midnight next Sunday' <br>
><br>
> This query needs to be executed every Wednesday to send out dashboard report.<br>
> It will search for tickets whose "Proposed Start Time" is between last Sunday<br>
> and this Sunday.<br>
><br>
> And unfortunately, I cant find any log about this query. I'm using it on the<br>
> New Search page, does there have any other way to test query?<br>
><br>
<br>
</span>A few things<br>
<br>
Your use of GMT in the CF name is... misleading, since Fields are set<br>
in the User's Time Zone, this may not work out as you intend.<br>
Additionally, relative dates are going to be calculated in the user's<br>
time zone. This means "midnight next sunday" will *actually* be<br>
2014-09-07 04:00:00 when it goes and looks in the DB (since I'm four<br>
hours behind GMT). Keep in mind also, did you mean Midnight at the<br>
start of sunday or midnight at the end of sunday?<br>
<br>
You can get exact parsing of the query by running code on the command<br>
line. Save this in a file and run it.<br>
<br>
use lib '/opt/rt4/lib/';<br>
use RT -init;<br>
<br>
my $t = RT::Tickets->new(RT->SystemUser);<br>
$t->FromSQL("Your Query");<br>
warn $t->BuildSelectQuery;<br>
<br>
-kevin<br>
<br>--<br>
RT Training - Boston, September 9-10<br>
<a href="http://bestpractical.com/training" target="_blank">http://bestpractical.com/training</a><br></blockquote></div><br></div>