Hi All,
I’m getting ready to deploy an XWiki install and I’m quite impressed with the capabilities. I’ve created numerous classes and such and am liking many of the features, but I’m a bit stuck on this one.
I have a class that is to hold software release information (i.e. release date, is it a GA or limited release, notes, instructions, etc.). This class is functioning fine, but I have created a second class to build a list display of all releases (a basic livetable marco filtered to the current document space, no big deal there). But it also needs to list the “current release”. I started with livetable, sorting the releases by release date desc, limiting pages to 1 and 1 result per page, etc… and started running into issues on 10.7, along with not wanting to restyle the livetable.
So now I’m just wanting to build the table manually and use xwql to query child documents of the current page to get the result that I’m looking for.
Currently I have this:
{{velocity}} #set($xwql = "from doc.object(XWiki.ReleaseClass) as release where doc.fullName <> 'XWiki.ReleaseTemplate' and release.LimitedRelease = 0 and release.ReleaseDate <= :date order by release.ReleaseDate desc") #set($results = $services.query.xwql($xwql).bindValue('date', $datetool.getSystemDate()).setLimit(1).execute()) (% class="box" %) ((( |=Release Version|=Release Date #foreach ($item in $results) #set($release = $xwiki.getDocument($item)) |[[$release.display("doc.title")>>${item}]]|$release.display("ReleaseDate")| #end ))) {{/velocity}}
and this does everything I’m looking for EXCEPT limit the search to child pages (we have several products and only want documents under the current document)
I’ve looked at the query module and changing the above to this does not throw errors, but it does not return ANY results:
{{velocity}} #set($xwql = "from doc.object(XWiki.ReleaseClass) as release where doc.space like :space and doc.fullName <> 'XWiki.ReleaseTemplate' and release.LimitedRelease = 0 and release.ReleaseDate <= :date order by release.ReleaseDate desc") #set($results = $services.query.xwql($xwql).bindValue('date', $datetool.getSystemDate()).bindValue('space').literal("${doc.space}.").anyChars().setLimit(1).execute()) (% class="box" %) ((( |=Release Version|=Release Date #foreach ($item in $results) #set($release = $xwiki.getDocument($item)) |[[$release.display("doc.title")>>${item}]]|$release.display("ReleaseDate")| #end ))) {{/velocity}}
if I hard code the space it’ll work but as I need this to be reusable without the need for code tweaks every time. it’s much easier for me to tell people to create a blank page and add the “ReleaseHomeClass” object and save than to store a bunch of code and educate a whole team on how to modify the code.
I’ve tried a few other things but something’s clearly not clicking correctly in my head so hopefully someone can help.
Thanks