clist - create comma-separated list


<clist $values>

The clist function returns the given list of values as one parenthetical, comma-separated value. If the list is empty, the returned value is empty too, instead of ().

This function can be used to create a Metamorph comma-separated values list. Note that a multi-value string variable is automagically turned into comma-separated values when used as an argument in a SQL command (here).

clist returns the $values in one parenthetical, comma-separated value, or an empty string if there are no values.


<$list = "red" "blue" "violet">
<clist $list>
<fmt "%mIH" $ret "Roses are red.">

$ret would have the value "(red,blue,violet)" after clist is called, and the output would be "Roses are <B>red</B>.".

The clist function was added Sep. 10 1996.

Note that a comma-separated list is a single set element in Metamorph. See the Metamorph documentation for details. Only parentheses are escaped in the output. Thus, if a value has a comma in it, it will be treated as multiple values in the list.


Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.