[xwiki-users] get last comment of some document
How is possible to get last comment of some document using velocity and XWQL? As I understand, need to write XWQL query for XWiki.XWikiComments object using filter by doc name. I trying to do something but every time I make some mistakes in my code ... Thanks beforehand Eugen Colesnicov -- View this message in context: http://xwiki.475771.n2.nabble.com/get-last-comment-of-some-document-tp705760... Sent from the XWiki- Users mailing list archive at Nabble.com.
For example, first I trying to list all comments and I don't understand, why getting all tags working well: select distinct obj.tags from Document doc, doc.object(XWiki.TagClass) as obj but if I trying to get comments like this: select distinct obj.comment from Document doc, doc.object(XWiki.XWikiComments) as obj I received an error. I cannot understand difference ... -- Thanks beforehand Eugen Colesnicov -- View this message in context: http://xwiki.475771.n2.nabble.com/get-last-comment-of-some-document-tp705760... Sent from the XWiki- Users mailing list archive at Nabble.com.
I did it! {{velocity}} #set($class="XWiki.XWikiComments") #set($name=$doc.fullName) #set($xwlquery="select obj.comment from Document doc, doc.object($class) as obj where doc.fullName='$doc.fullName' order by obj.date desc") #set($list=$services.query.xwql($xwlquery).setLimit(1).execute()) #foreach($item in $list) $item #end {{/velocity}} -- View this message in context: http://xwiki.475771.n2.nabble.com/get-last-comment-of-some-document-tp705760... Sent from the XWiki- Users mailing list archive at Nabble.com.
On Dec 3, 2011, at 12:26 PM, Eugen Colesnicov wrote:
I did it!
{{velocity}} #set($class="XWiki.XWikiComments") #set($name=$doc.fullName) #set($xwlquery="select obj.comment from Document doc, doc.object($class) as obj where doc.fullName='$doc.fullName' order by obj.date desc") #set($list=$services.query.xwql($xwlquery).setLimit(1).execute()) #foreach($item in $list) $item #end {{/velocity}}
cool, I've added it here: http://extensions.xwiki.org/xwiki/bin/preview/Extension/Get+Last+Comment Thanks -Vincent
participants (2)
-
Eugen Colesnicov -
Vincent Massol