On Thu, Aug 28, 2008 at 4:08 PM, Bruno Neves <[email protected]> wrote:
Greetings
My objective is to list every document with some tag (e.g. "MainTag"), and next, select all tags of these documents without repeating any of them (including "MainTag").
I tried to merge the next two queries but without sucess.
This query selects every document that have the tag "KB-4D":
#set($sql = ", BaseObject as obj, DBStringListProperty as prop where obj.name=doc.fullName and obj.className='XWiki.TagClass' and obj.id=prop.id.id and prop.id.name='tags' and 'KB-4D' in elements(prop.list) order by doc.name asc") #set ($list = $xwiki.searchDocuments($sql))
This query selects every tags present in the documents listed by the previous query:
#set($sql = "select distinct elements(prop.list) from BaseObject as obj, DBStringListProperty as prop where obj.className='XWiki.TagClass' and obj.id=prop.id.id and prop.id.name='tags' and obj.name='$item'") #set ($tags = $xwiki.search($sql))
Can anyone help me with this?
This should do the trick (require programming rights) : #set($sql = "select distinct elements(prop.list) from XWikiDocument as doc, BaseObject as obj, DBStringListProperty as prop where obj.name=doc.fullName and obj.className='XWiki.TagClass' and obj.id=prop.id.id and prop.id.name='tags' and 'KB-4D' in elements(prop.list) order by doc.name asc") #set ($list = $xwiki.search($sql))
PS: How can I put snippet code on code.xwiki.org? I need to login but I am not registered.
You can register from http://www.xwiki.org -- Jean-Vincent Drean