> On 15 Apr 2016, at 18:58, Matthias Wegner <mic.mat.weg...@web.de> wrote:
> 
> Hi Vincent,
> 
> sorry i was not specific.
> 
> Here an example:
> 
> I want to make a page like:
> MAIN.Overall
> {{velocity}}
> #set($SUPERCOUNTER=0)
> #set($hql = "where ... order by doc.title asc")
> #set($docs = $xwiki.searchDocuments($hql, 0, 0))
> #foreach ($dd in $docs)
>   #set( $d = $xwiki.getDocument($dd))
>   $d.getName()
>   {{include document="$dd" context="new"/}}
> #end
> {{/velocity}}
> 
> And another page like:
> SOMESPACE.Doc1
> {{velocity}}
> #set($SUPERCOUNTER=$SUPERCOUNTER + 1)
> * Counter: $SUPERCOUNTER
> {{/velocity}}
> 
> And another page like:
> SOMESPACE.Doc2
> {{velocity}}
> #set($SUPERCOUNTER=$SUPERCOUNTER + 1)
> * Counter: $SUPERCOUNTER
> #set($SUPERCOUNTER=$SUPERCOUNTER + 1)
> * Counter: $SUPERCOUNTER
> {{/velocity}}
> 
> For that i want expect a result of MAIN.Overall like
> 
> Doc1
> * Counter: 1
> Doc2
> * Counter: 2
> * Counter: 3
> 
> But because of the needed "new" context the SUPERCOUNTER is always not 
> defined. So i need something which can store a value independed from a 
> document and can be written and is readable. You understod now?

Ok I understand (I think).

There are various solutions, see 
http://platform.xwiki.org/xwiki/bin/view/DevGuide/SavingData

Thanks
-Vincent

> Regards,
> Matthias
> 
> Am 14.04.2016 um 19:18 schrieb Vincent Massol:
>> Hi Matthias,
>> 
>>> On 14 Apr 2016, at 19:05, Matthias Wegner <mic.mat.weg...@web.de> wrote:
>>> 
>>> Hi All,
>>> 
>>> i want to count over different document a $counter in velocity. Do you have
>>> an easy way that i can store and read that value so i can use it on all
>>> documents (with different context)?
>> Sorry, I don’t understand what you want.
>> 
>> WDYM by “count over different document”?
>> 
>> If you wish to run a count query, see
>> http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module
>> 
>> Thanks
>> -Vincent
>> 
>> 
>>> Is there a macro for such a job? I not found anything.
>>> 
>>> Regards,
>>> Matthias
>>> 
>>> --
>>> View this message in context: 
>>> http://xwiki.475771.n2.nabble.com/Parameter-in-different-contexts-tp7598994.html
>> _
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to