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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to