Brilliant! You can even do maps, so my example become: #set($results=$xwiki.search("select new map(doc.name as name, doc.date as date) from XWikiDocument doc",10,0)) 1.1 Better table {table} doc | date #foreach ($row in $results) $row.get("name") | $row.get("date") #end {table} Much more pleasant. Thanks! Cheers, Robin On 23/04/06, Frank Haefemeier <[email protected]> wrote:
Hi Robin,
Am Fr, den 24.03.2006 schrieb Robin Fernandes um 17:41:
The real difficulty I have is in directly addressing any field of a returned row. I can loop through it and see what each one is, but without doing that and assigning each field based on the iteration count...
I have this problem too. I can't find a good way to handle the list of Objects you get back from a query of which the result spans multiple columns.
Foreach seems to internally cast the Object into something it can iterate - it's the only solution I've found, and it's a bit nasty. If anyone has a better solution, let us know! :)
#set($results=$xwiki.search("select doc.name, doc.date from XWikiDocument doc",10,0))
You can do the following: select new list(doc.name, doc.date) from XWikiDocument doc
{table} doc | date #foreach ($row in $results) #### $row is a java.lang.Object... #### can't figure out how to access the columns except with foreach:
#set($docName=$row.get(0)) #set($docDate=$row.get(1))
$docName | $docDate #end {table}
Bye Frank
-- Dipl. Inform. Frank Häfemeier <[email protected]> ----------------------------------------------------
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws