$xwiki.getDocument($ShiftLog.getAuthor()).getObject('XWiki.XWikiUsers'). getProperty('email').getValue()" That worked great! I didn't know that I needed to call the $ShiftLog And yes, if $doc.title != ShiftLogSheet makes it so my sheet doesn't display in the results. Or at least I think, I copied the coded from xwiki.org it's the FAQ application code. If there was a way to make that a link to open outlook that would be nice. Like <a href="mailto: $xwiki.getDocument($ShiftLog.getAuthor()).getObject('XWiki.XWikiUsers'). getProperty('email').getValue()">$xwiki.getDocument($ShiftLog.getAuthor( )).getObject('XWiki.XWikiUsers').getProperty('email').getValue()</a> But that is HTML and too complicated to intigrate into the velocity code. Is there an easy way to format the results into two columns. On the left being the doc names and on the right being the author. ~thanks, Grant -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Marius Dumitru Florea Sent: Tuesday, July 13, 2010 12:30 AM To: [email protected] Subject: Re: [xwiki-devs] For Each loop help Hi Grant, On 07/12/2010 05:28 PM, Sales, G. (Grant) wrote:
== Shift Turnover Logs ==
{{velocity}} #set($sql = ", BaseObject as obj where obj.name=doc.fullName and obj.className='ShiftLog.ShiftLogClass' and obj.name<>'ShiftLog.ShiftLogTemplate' order by doc.creationDate desc")
##set($sql = ", BaseObject as obj where obj.name=doc.fullName and obj.className='ShiftLog.ShiftLogClass' and obj.name<>'ShiftLog.ShiftLogTemplate'") #set($results = $xwiki.searchDocuments($sql))
I suppose $results contains the expected items, right? You can test by displaying $item in the following loop.
#if($results.empty) No Shift Logs has been created yet! #else #foreach ($item in $results)
#if($doc.title != "ShiftLogSheet")
Are you sure you want to test the $doc.title? $doc is the current document (e.g. the document containing this velocity code). This test is not affected by the loop and thus executing it in each loop doesn't seem right. Maybe you should test $item (a document name) or $ShiftLog.title .
#set($ShiftLog = $xwiki.getDocument($item))
* [[${ShiftLog.display("question").replace("<p>", "").replace("</p>", "")}>>${item}]]
$xwiki.getDocument($doc.getAuthor()).getObject('XWiki.XWikiUsers').get Pr operty('email').getValue()
This line displays the same thing in all the loops. Maybe you wanted to write $ShiftLog.getAuthor() instead of $doc.getAuthor() ? Hope this helps, Marius
#end #end #end {{/velocity}} ))) )))
All I want to do is display who edited the file last. All this is currently doing is showing who made the Shift Log.WebHome
Thanks, Grant
Grant Sales Security Operations Analyst ING 111 Washington Ave South Minneapolis, MN 55401 Tel: 612.342.7889 Fax: 612.342.3428 Cell: 320.761.0966 Email: [email protected] www.ing-usa.com ING. Your future. Made easier. (r)
---------------------------------------------------------
NOTICE: The information contained in this electronic mail message is confidential and intended only for certain recipients. If you are not an intended recipient, you are hereby notified that any disclosure, reproduction, distribution or other use of this communication and any attachments is strictly prohibited. If you have received this communication in error, please notify the sender by reply transmission and delete the message without copying or disclosing it.
====================================================================== ====================== _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs