Hi Gary,

You mean "velocityCount" ?
It should be set in velocity.properties like:

directive.foreach.counter.name = velocityCount
directive.foreach.counter.initial.value = 1


using like below:
#foreach( $i in $list )
  $i is the number of $velocityCount
#end

HTH

Best Regards,
trad-ex


>Hello all,
>
>I have data stored in a collection. There is no field within the 
>collection that is suitable for use as a sorting parameter. Externally, 
>I can generate this sorting index, but I need a means for adding this 
>index into my collection.
>
>I know how to scan through records, obtain the correct ones, and insert 
>them into a new collection. I also know how I can generate the value of 
>the required index. However, I don't know how to associate the index 
>with the appropriate record in the new collection.
>
>Below is my current code for scanning, choosing the valid records and 
>including them into the new collection. Any help on how to include the 
>index value would be appreciated
>
>#set ($newcollection = [])
>#foreach ($rec in $data.collection)
>        #if($rec.name == "valid")                     ## choose on valid 
>records
>            #set ($index = ???)                       ## calculate index 
>value
>            #set ($n = $newcollection.add($rec))      ## add record and 
>index to new collection
>       #end
>#end
>
>Then, I would like to be able to retrieve the records as follows:
>
>#foreach ($newrec in $SortTool.sort($newcollection, "index")   ## choose 
>records from new collection, sorted by "index"
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to