Hi,

I think your query might be far easier to write using XWQL instead of HQL
(see
http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module#HXWQLImplementationDetails),
if you want to go back to initial solution.

BR,
Jeremie


2013/5/13 Guofeng Zhang <[email protected]>

> I solve it using the data in the object, not based on the HQL query.
>
> #set ($hql = ", BaseObject as obj where obj.name=doc.fullName and
> obj.className='XWiki.TodoClass' and obj.name<>'XWiki.TodoTemplate' order
> by doc.date desc")
> #foreach ($todo in $xwiki.searchDocuments($hql, 5, 0))
>   #set ($todoDoc = $xwiki.getDocument($todo))
>   #set ($todoObj = $todoDoc.getObject("XWiki.TodoClass"))
>   #if ($todoObj.Status != 'Finished')
>     #set($description = $todoObj.Description)
>      * [[$description.replace("<p>", "").replace("</p>", "") >>$todo]]
>   #end
> #end
>
> Any advice?
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf
> Of Guofeng Zhang
> Sent: Friday, May 10, 2013 2:11 PM
> To: [email protected]
> Subject: [xwiki-users] Todo tutorial: how to list the document in Todo
> panel?
>
> Hi,
>
> I follow the Todo tutorial (
> http://www.theserverside.com/news/1363830/XWiki-A-Platform-for-Collaborative-Apps)
> on XWiki 5.0.1. By making a little changes and using XWiki Sytanx 2.0. The
> Todo application runs well on my XWiki instance. But I stuck at My Todo
> Panel.
>
> Listing 7 in the tutorial shows the following code to list all Todo
> documents on My Todo Panel assigned to the current logged in user and that
> are not finished:
>
> #set ($hql = ", BaseObject as obj, StringProperty as prop1, StringProperty
> as prop2 where obj.name=doc.fullName and obj.className='XWiki.TodoClass'
> and obj.name<>'XWiki.TodoClassTemplate' and obj.id=prop1.id.id and
> prop1.id.name='Status'
> and prop1.value <> 'Finished' and obj.id=prop2.id.id and prop2.id.name
> ='Assignee'
> and prop2.value='$context.user' order by doc.date desc")
>
> #foreach ($todo in $xwiki.searchDocuments($hql, 5, 0)) ......
>
> It has the following description about the above code:
> "The hard part in creating this My Todo Panel is in finding out the
> correct HQL query to write. You have to know that Static List Class
> properties and User Class properties are stored internally using a
> StringProperty Object."
>
> For me on XWiki 5.0.1,  no document returned by the above code and I do
> not know where to start from to fix it.
>
> I know tutorial is old (on 1 Dec, 2007), so maybe the object store has
> been changed late.
>
> Could you give me instructions how to make the above code work?
>
> It is appreciated if you could give some fix to the above code and I like
> to test the fix.
>
> Thanks for your help.
>
> Guofeng
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to