[rt-users] Find the first day of this month
Hi all, This has been kicked around a few times over the years if google & the list archives are anything to go on, but I haven't actually seen a solution that meets what any of the requestors (and me) want. Which is... to run a search using a date like: Queue = 'myqueue' and ( ( Status = 'open' or Status = 'new' ) OR ( Resolved > 'first dow after last month' ) ) or "last month + 1" or "first dom" or really anything that will programmatically always return the first day of this month. I have a shell script that does this by constructing a date in bash, and then passing the date to the query as a variable, but I can't do this within the "save search" function. The reason I'm after "save search" is that the HTML reports are easier for humans to read than the TSV extracts that the bash scripts generate. things like "last month" get close - but it simply works out "now - 30 days". And I can't see a way in Time::ParseDate to extract the month and year in the same way I would in bash using something like `date +%b` MIT have a nice page that has better examples than the Time::Parse doco http://kb.mit.edu/confluence/pages/viewpage.action?pageId=4269222 but I can't work out how to construct the thing I want using what's available. Please tell me I'm wrong! Regards, Chris
Re: [rt-users] Find the first day of this month
I also looked at the Attributes table, but the actual SavedSearch is stored as a binary blob AFAICT? I was going to head down the path of updating the contents of the field with a programmatically generated string once a day or something like that: queue = "myqueue" and Created > "2015-12-01" i.e. just change the date in question every day so that the Dashboards and scheduled email reports always have the desired dates. But... I can't see how to do it with what's there... (a BLOB). And it looks really blobby too - proper blob... not just a bunch of TEXT that happens to be stored as a BLOB? On 8 December 2015 at 21:55, Chris Herrmannwrote: > Hi all, > > This has been kicked around a few times over the years if google & the > list archives are anything to go on, but I haven't actually seen a solution > that meets what any of the requestors (and me) want. > > Which is... to run a search using a date like: > > Queue = 'myqueue' and ( ( Status = 'open' or Status = 'new' ) OR ( > Resolved > 'first dow after last month' ) ) > > > or "last month + 1" or "first dom" or really anything that will > programmatically always return the first day of this month. I have a shell > script that does this by constructing a date in bash, and then passing the > date to the query as a variable, but I can't do this within the "save > search" function. > > > The reason I'm after "save search" is that the HTML reports are easier for > humans to read than the TSV extracts that the bash scripts generate. > > > things like "last month" get close - but it simply works out "now - 30 > days". And I can't see a way in Time::ParseDate to extract the month and > year in the same way I would in bash using something like `date +%b` > > > MIT have a nice page that has better examples than the Time::Parse doco > http://kb.mit.edu/confluence/pages/viewpage.action?pageId=4269222 but I > can't work out how to construct the thing I want using what's available. > > > Please tell me I'm wrong! > > > Regards, > > > Chris >
Re: [rt-users] Find the first day of this month
Hi Chris, won't help you now but RT 4.4.0 will support this if you set $PreferDateTimeFormatNatural to 1: https://github.com/bestpractical/rt/commit/4836a20 If you really need this in RT 4.2 you can try applying these commits: https://github.com/bestpractical/rt/commit/f446755 https://github.com/bestpractical/rt/commit/e527517 https://github.com/bestpractical/rt/commit/4836a20 Maybe this will work, but I didn't checked it. Chris Am 08.12.2015 um 11:55 schrieb Chris Herrmann: > Hi all, > > This has been kicked around a few times over the years if google & the > list archives are anything to go on, but I haven't actually seen a > solution that meets what any of the requestors (and me) want. > > Which is... to run a search using a date like: > > Queue = 'myqueue' and ( ( Status = 'open' or Status = 'new' ) OR ( > Resolved > 'first dow after last month' ) ) > > > or "last month + 1" or "first dom" or really anything that will > programmatically always return the first day of this month. I have a > shell script that does this by constructing a date in bash, and then > passing the date to the query as a variable, but I can't do this within > the "save search" function. > > > The reason I'm after "save search" is that the HTML reports are easier > for humans to read than the TSV extracts that the bash scripts generate. > > > things like "last month" get close - but it simply works out "now - 30 > days". And I can't see a way in Time::ParseDate to extract the month and > year in the same way I would in bash using something like `date +%b` > > > MIT have a nice page that has better examples than the Time::Parse doco > http://kb.mit.edu/confluence/pages/viewpage.action?pageId=4269222 but I > can't work out how to construct the thing I want using what's available. > > > Please tell me I'm wrong! > > > Regards, > > > Chris >