You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Apache Wiki <wi...@apache.org> on 2006/09/19 19:20:17 UTC
[Jakarta-velocity Wiki] Update of "VelocityCommaIfNeeded" by Stephen Popp
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Jakarta-velocity Wiki" for change notification.
The following page has been changed by Stephen Popp:
http://wiki.apache.org/jakarta-velocity/VelocityCommaIfNeeded
New page:
How can you easily create a comma seperated list if items?
Add the global macro:
*### Add a comma if needed - pass in $velocityCount for $count
*#macro('''commaIfNeeded''' $count $list)
*#set ( $lastone = $list.Count - 1 )
*#if( $count <= $lastone ),
*#else
*
*#end
*#end
Use the '''commaIfNeeded''' Macro to create a comma seperated list:
*#foreach ($column in ${Table.ColumnList})
* p_${column.Name} IN "${Table.Name}"."${column.Name}"%Type#commaIfNeeded( $velocityCount $Table.ColumnList )
*#end
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org