Hi! Eugen Colesnicov wrote:
Thanks, Ricardo! But for me your example is not enough.
I need to filter not by fixed date, but for dynamic criteria - current date - 5 days ... How is it possible?
Well, this is not hard to do... after the examples shown here... http://platform.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples
Maybe I should do it by 2 steps: 1) set target date (current date - 5 days) as value, 2) use this target date (fixed value) as a filter criteria. Ok, but for this - how is it possible to define my target date = current date - 5 days?
This simple script works for me here... #set($query = ", BaseObject as obj, StringProperty as firstName, StringProperty as lastName where doc.fullName = obj.name and obj.className='XWiki.XWikiUsers' and obj.id=firstName.id.id and firstName.id.name='first_name' and obj.id=lastName.id.id and lastName.id.name='last_name' and (firstName.value like '%Ricardo%' or firstName.value like '%Mar%') and lastName.value like '%Rodr%' and year(doc.date) = year(current_date()) and month(doc.date) = month(current_date()) and day(doc.date) > (day(current_date()) - 100) order by doc.fullName asc") #set($results=$xwiki.searchDocuments($query)) #foreach($item in $results) #set($itemdoc = $xwiki.getDocument($item)) [$itemdoc.display('first_name')>$item]<br/> #end HTH! -- Ricardo RodrÃguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems