Set-type attributes can hold multi-value data, e.g. a set of tags. Some action operators can create sets, most notably the links() operator. Having created a set it can be useful to make it into an HTML list. This is easily done using the format() operator:
format($MySet"
\n","\t
\n");
This gives:
- cow
- dog
- eel
More convenient my be to use .format():
$MySet.format("
\n","\t
\n");
If the above were a list of notes' $Name values it is also possible to make the list items into links. This is possible using a two-step process. First the existing set's data is copied to a new set with each value enclosed by link export code:
$MySetB = format($MySet,"","^linkTo(",")^;","");
The format() operator is now called a second time to make an HTML list using a String attribute $FormattedList to hold the output:
$FormattedList = format($MySetB,"
\n","\t
\n");
On export, the ^linkTo()^ codes are expanded:
The $FormattedList attribute is simply a placeholder to store the fully formatted list ready for use in an export template, thus:
^value($FormattedList)^
.
The overall process can be done without needing a second set attribute if link() can be used to make the source set of values. Note the need to use the eval() operator to capture the link() output, on the fly, in set data form to pass into format():
$MySet = format(eval(links(Data).outbound.example.$Name),"","^linkTo(",")^;","");
The second step remains the same:
$FormattedList = format($MySet,"
\n","\t
\n");