[xwiki-users] retrieving a class property
Hi all, This code retrieves and shows the document name of all the documents created with a given class: #set ($sql = ", BaseObject as obj where obj.name=doc.fullName and obj.className='${doc.web}.${class}Class' and obj.name<>'${doc.web}.${class}ClassTemplate'") #foreach ($item in $xwiki.searchDocuments($sql)) * [${item}] #end In a new class I've created, these documents have a property called Name. Please, how could I list this property for each entry instead of the document name? Thank you for your help, Ricardo -- Ricardo RodrÃguez Your EPEC Network ICT Team
[Ricardo Rodriguez] Your EPEC Network ICT Team wrote:
Hi all,
This code retrieves and shows the document name of all the documents created with a given class:
#set ($sql = ", BaseObject as obj where obj.name=doc.fullName and obj.className='${doc.web}.${class}Class' and obj.name<>'${doc.web}.${class}ClassTemplate'") #foreach ($item in $xwiki.searchDocuments($sql)) * [${item}] #end
In a new class I've created, these documents have a property called Name. Please, how could I list this property for each entry instead of the document name?
Yes, using the privileged call (requires programming rights): #set($sql = "select prop.value from BaseObject obj, StringProperty prop where obj.className = '${doc.web}.${class}Class' and obj.name <> '${doc.web}.${class}ClassTemplate' and prop.id.id = obj.id and prop.id.name = 'Name'") #foreach($value in $xwiki.search($sql)) * $value #end -- Sergiu Dumitriu http://purl.org/net/sergiu/
participants (2)
-
[Ricardo Rodriguez] Your EPEC Network ICT Team -
Sergiu Dumitriu