Hi Sylvain, On 23 Sep 2015 at 13:05:18, Thomas Mortagne ([email protected](mailto:[email protected])) wrote:
Unfortunately extracting the year of a date field is not supported by XWQL. See http://jira.xwiki.org/browse/XWIKI-6645.
As a workaround you could maybe use HQL, see http://platform.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples#HAdvan... Thank -Vincent
On Wed, Sep 23, 2015 at 12:01 PM, Sylvain MARIE wrote:
Hello,
The following query counts documents by publication date. {{velocity}} ## Count all publication dates #set($results=$services.query.xwql("select guide.DocumentDate, count(guide.DocumentDate) from Document doc, doc.object(BIMGuides.GuideClass) as guide group by guide.DocumentDate order by guide.DocumentDate").execute()) PublicationDate,Count #foreach($result in $results) #set($resDate = $result.get(0)) #set($resString = $resDate.toString().substring(0, 10)) $resString,$result.get(1) #end {{/velocity}}
I would like to regroup publication dates by year (getting « 2014,3 » when 2 documents are published in Jan2014 and 1 in Oct2014) instead of getting all single dates.
Any idea ?
Thank you in advance! Sylvain