On Wed, May 21, 2008 at 10:30 PM, Glenn Everitt <[email protected]> wrote:
I found this: http://platform.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples#HPrivi...
Getting documents where objects' properties equals some value
#displayQuery(select doc.fullName from XWikiDocument doc, BaseObject obj, StringProperty prop where doc.fullName=obj.name and obj.className='XWiki.XWikiUsers' and prop.id.id=obj.id and prop.name='first_name' and prop.value='Jean-Vincent' true)
What is #displayQuery ? So I guessed and tried this:
Just a simple macro that displays the query and results from a given query (meant to be used when documenting hql queries).
#set ($sql = "select doc.author from XWikiDocument doc, BaseObject obj, StringProperty prop where doc.author=obj.name and obj.className='XWiki.ArticleClass' and prop.id.id=obj.id and prop.name='author' and prop.value='XWiki.GEVERITT'") <p>$sql</p> #set($results =$xwiki.search($sql, 30, 0)) #set($arrayresults = $results.toArray())
#foreach($res in $results) <p>$res</p> #end
but I don't understand how to specify the name of author - Help.
A snippt to achieve this : #foreach($res in $xwiki.search("select distinct doc.creator from XWikiDocument doc, BaseObject obj where doc.fullName=obj.name and obj.className='XWiki.ArticleClass'", 0, 0)) * $res #end -- Jean-Vincent Drean