Thanks for the reply,
the dtDateToCompare variable works correctly when I compare to an actual
document property, eg $doc.modifiedDate, so from what I can see it's
assessing it correctly.
Here's the rub.
By sheer luck (and blindly trying any combination that'd make some sort of
sense), it seems the actual problem is that the property should be
referenced using DateProperty, not StringProperty (at least, thats what
works).
Please can someone in dev confirm/deny the following query for
$xwiki.search:
select obj.name
from
   BaseObject obj,
   XWikiDocument doc,
   DateProperty propnrd
where
   obj.className='XWiki.clickClass' and
   obj.name<>'XWiki.clickClassTemplate' and
   obj.name not like('%/%') and
   doc.fullName=obj.name and
   propnrd.id.id=obj.id and
   propnrd.id.name='clickDateAssign' and
   propnrd.value < '${dtDateToCompare}'
order by
   obj.name asc
On Fri, Feb 22, 2008 at 11:13 AM, Marius Dumitru Florea <
mariusdumitru.florea(a)xwiki.com> wrote:
  Hi,
 I don't know for sure but I suspect your problem has something to do with
 date format. At the time the page is rendered '${dtDateToCompare}' gets
 translated into a string (using toString if it's not already a string).
 The date format used (explicitly by you or implicitly by toString) may not
 match  the one used by your DB. If this is the case then I see 2
 solutions:
 * find out the date format used by your DB (a simple select on a table
 having a date field might do) and format the dtDateToCompare
 correspondingly
 * replace '${dtDateToCompare}' with a parameter using ? (the JDBC syntax)
 or :paramName (HQL syntax) and call the corresponding searchDocuments
 method.
 I hope this helps,
 Marius
  Hi everyone, having a small problem on an HQL
query (and hope someone's
 managed to get this working before)
 NOTE: $dtDateToCompare is yesturdays date, generated with groovy
 select obj.name
 from
    BaseObject obj,
    XWikiDocument doc,
    StringProperty propnrd
 where
    obj.className='XWiki.clickClass' and
    obj.name<>'XWiki.clickClassTemplate' and
    obj.name not like('%/%') and
    doc.fullName=obj.name and
    propnrd.id.id=obj.id and
    propnrd.id.name='clickDateAssign' and
    propnrd.value < '${dtDateToCompare}'
 order by
    obj.name asc
 This works if I use the modified date property of the document (as a
 test);
 but not for a custom date property (propnrd.id.name='clickDateAssign' is 
 a
  date property of the class).
 Anybody do something similar and can share some pointers?  Using MySQL 
 if
  that makes any difference
 _______________________________________________
 users mailing list
 users(a)xwiki.org
 
http://lists.xwiki.org/mailman/listinfo/users
 
 _______________________________________________
 users mailing list
 users(a)xwiki.org
 
http://lists.xwiki.org/mailman/listinfo/users