>>>>>
________________________________________
>>>>> From: users-bounces(a)xwiki.org [users-bounces(a)xwiki.org] On Behalf Of
Marius Dumitru Florea [mariusdumitru.florea(a)xwiki.com]
>>>>> Sent: 29 May 2012 09:45
>>>>> To: XWiki Users
>>>>> Subject: Re: [xwiki-users] help with a query
>>>>>
>>>>> On Mon, May 28, 2012 at 11:54 PM,
<Ricardo.Julio.Rodriguez.Fernandez(a)sergas.es> wrote:
  >>>
________________________________________
>>> From: users-bounces(a)xwiki.org [users-bounces(a)xwiki.org] On Behalf Of Marius
Dumitru Florea [mariusdumitru.florea(a)xwiki.com]
>>> Sent: 28 May 2012 08:48
>>> To: XWiki Users
>>> Subject: Re: [xwiki-users] help with a query
>>>
>>> On Sun, May 27, 2012 at 10:29 AM, 
<Ricardo.Julio.Rodriguez.Fernandez(a)sergas.es> wrote:
  Hi!
 
________________________________________
 From: users-bounces(a)xwiki.org [users-bounces(a)xwiki.org] On Behalf Of Sergiu Dumitriu
[sergiu(a)xwiki.com]
 Sent: 27 May 2012 02:44
 To: XWiki Users
 Subject: Re: [xwiki-users] help with a query
 On 05/26/2012 07:29 PM, Ricardo.Julio.Rodriguez.Fernandez(a)sergas.es wrote: 
 Sorry,
but I'm not able to get a query getting this:
 All comments added to XWiki users. 
 
 > Do you want to get the comments themselves as
a whole, just the comment
> body, or just the name of the user documents where comments have been added? 
 I've found this...
 
http://extensions.xwiki.org/xwiki/bin/Extension/Get+Last+Comment
 Coming from this thread...
 
http://xwiki.markmail.org/thread/qwnwzoa23ewdt64w
 Sorry, I should have found it before!
 
  it requires programming rigths, but this is not a
problem rigth now for us. What I'm not able to understand here is the role of
setLimit(1). Please, check this... 
 >>> setLimit sets the maximum number of
rows to return. In this case,
>>> since the snippet is showing the last comment, the query needs to
>>> return at most one row. 
 http://atriumkm.idisantiago.es/bin/ICT/ListCommentsWithProgrammingRights
 We get the same result by using or not using it. Please, what am I missing here?
 
 
  Also, whatever value I use for setLimit(), I
always get the first value in the list as ordered in the xwql statement. 
 >>> Maybe you changed the query in the
mean time, but I can see both
>>> comments displayed when you don't set the limit. 
 Thanks, Marius. No, I didn't change the query. Please, see this...
 $services.query.xwql($xwlquery).setLimit(1).execute().get(0) First
 $services.query.xwql($xwlquery).execute().get(0) First
 Only First (comment) is displayed in both cases. The first code lines includes
setLimit(1) but the second one doesn't.
 
 
  Please, where am I lost? Thanks! 
 >>>>> It's simple. execute() returns
a list:
>>>>>
>>>>> ['First']
>>>>> ['First', 'Second']
>>>>>
>>>>> In both cases, the first item in the list obtained with get(0) is
>>>>> 'First'. There's nothing wrong with that. setLimit() sets
the maximum
>>>>> size of the returned list. In the first case the list has maximum one
>>>>> element, and in the second case it has the size equal with the number
>>>>> of matching rows found in the database. 
Great! Thanks for the explanation! I've added some more lines to check that I've
perfectly understood the issue. So, setLimit() is used to recover a list as short as
required to satisfy what we are looking for, the first or last comment on a row, and
get(0) is used to get this single item.
http://atriumkm.idisantiago.es/bin/ICT/ListCommentsWithProgrammingRights
I do hope I'm able to remember all things I learn here!
Thanks for your help,
Ricardo
 
>>>>
 >>> Hope this helps,
>>> Marius 
>>>> 
 >>> Hope this helps,
>>> Marius 
 I would not be hard to apply this query to all desired documents by looping through them.
Please, is this the most effective/economic in terms of process work way of doing this
query?
 Thank you so much for your help!!!
  Please, could you help me?
 Thank you very much,
 Ricardo
 --
 Ricardo Rodríguez
 Research Management and Promotion Technician
 Technical Secretariat
 Health Research Institute of Santiago de Compostela (IDIS)
 
http://www.idisantiago.es
 Nota: A información contida nesta mensaxe e os seus posibles documentos adxuntos é
privada e confidencial e está dirixida únicamente ó seu destinatario/a. Se vostede non é
o/a destinatario/a orixinal desta mensaxe, por favor elimínea. A distribución ou copia
desta mensaxe non está autorizada.
 Nota: La información contenida en este mensaje y sus posibles documentos adjuntos es
privada y confidencial y está dirigida únicamente a su destinatario/a. Si usted no es
el/la destinatario/a original de este mensaje, por favor elimínelo. La distribución o
copia de este mensaje no está autorizada.
 See more languages: 
http://www.sergas.es/aviso_confidencialidad.htm 
 --
 Sergiu Dumitriu
 
http://purl.org/net/sergiu/
 _______________________________________________
 users mailing list
 users(a)xwiki.org
 
http://lists.xwiki.org/mailman/listinfo/users
 Nota: A información contida nesta mensaxe e os seus posibles documentos adxuntos é
privada e confidencial e está dirixida únicamente ó seu destinatario/a. Se vostede non é
o/a destinatario/a orixinal desta mensaxe, por favor elimínea. A distribución ou copia
desta mensaxe non está autorizada.
 Nota: La información contenida en este mensaje y sus posibles documentos adjuntos es
privada y confidencial y está dirigida únicamente a su destinatario/a. Si usted no es
el/la destinatario/a original de este mensaje, por favor elimínelo. La distribución o
copia de este mensaje no está autorizada.
 See more languages: 
http://www.sergas.es/aviso_confidencialidad.htm
 _______________________________________________
 users mailing list
 users(a)xwiki.org
 
http://lists.xwiki.org/mailman/listinfo/users 
_______________________________________________
 users mailing list
 users(a)xwiki.org
 
http://lists.xwiki.org/mailman/listinfo/users
 Nota: A información contida nesta mensaxe e os seus posibles documentos adxuntos é
privada e confidencial e está dirixida únicamente ó seu destinatario/a. Se vostede non é
o/a destinatario/a orixinal desta mensaxe, por favor elimínea. A distribución ou copia
desta mensaxe non está autorizada.
 Nota: La información contenida en este mensaje y sus posibles documentos adjuntos es
privada y confidencial y está dirigida únicamente a su destinatario/a. Si usted no es
el/la destinatario/a original de este mensaje, por favor elimínelo. La distribución o
copia de este mensaje no está autorizada.
 See more languages: 
http://www.sergas.es/aviso_confidencialidad.htm
 _______________________________________________
 users mailing list
 users(a)xwiki.org
 
http://lists.xwiki.org/mailman/listinfo/users
 _______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
Nota: A información contida nesta mensaxe e os seus posibles documentos adxuntos é privada
e confidencial e está dirixida únicamente ó seu destinatario/a. Se vostede non é o/a
destinatario/a orixinal desta mensaxe, por favor elimínea. A distribución ou copia desta
mensaxe non está autorizada.
Nota: La información contenida en este mensaje y sus posibles documentos adjuntos es
privada y confidencial y está dirigida únicamente a su destinatario/a. Si usted no es
el/la destinatario/a original de este mensaje, por favor elimínelo. La distribución o
copia de este mensaje no está autorizada.
See more languages: 
http://www.sergas.es/aviso_confidencialidad.htm