[Ricardo Rodriguez] eBioTIC. wrote:
> Hi!
> 
> I'm trying to understand the Query Guide available at 
> http://xpescaderias.environmentalchange.net/xwiki/bin/view/Species/SpeciesClassSheet
>  
> but still failing to get an answer to a problem.
> 
> I navigate to a document with this query...
> 

#set($species = 
$doc.getObject('Species.SpeciesClass').getProperty('GalicianName').getValue())
> #set($query = ", BaseObject as obj, LargeStringProperty as prop where 
> doc.fullName = obj.name and obj.className='Users.PdrUserClass' and 
> obj.id=prop.id.id and prop.id.name='Species' and prop.value like '" + 
> $species + "' order by doc.fullName asc")

That should do it.

Note:
For better security the query should be:
#set($query = ", BaseObject as obj, LargeStringProperty as prop where 
doc.fullName = obj.name and
obj.className='Users.PdrUserClass' and obj.id=prop.id.id and 
prop.id.name='Species' and prop.value
like ? order by doc.fullName asc")
then
#set($results = $xwiki.searchDocuments($query, [$species])

This makes sure $species is escaped preventing sql injection.

Caleb

> 
> I would like to set the value of $species to the value of the property 
> GalicianName of the class Species.SpeciesClass instantiated in this 
> document.
> 
> Please, could anybody help me to solve this doubt? Thanks!
> 
> Ricardo
> 

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to