This version is out of date, covering development from v9.0.0 to v9.3.0. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox v9 Icon

Exporting Set-type data

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. For instance, if $MySet has values 'cow', 'dog' and 'eel':


This gives:


It is more convenient is to use the newer .format() command:


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 = $MySet.format("","^linkTo(",")^;",""); 

The format() operator is then called a second time to make an HTML list using a String attribute $FormattedList to hold the output:

$FormattedList = $MySetB.format("<ul>\n","\t<li>","</li>\n","</ul>\n"); 

On export, the ^linkTo()^ codes are expanded:

	<li><a href="Data/cow.html">cow</a></li>
	<li><a href="Data/dog.html">dog</a></li>
	<li><a href="Data/eel.html">eel</a></li>

The $FormattedList attribute is simply a placeholder to store the fully formatted list ready for use in an export template, thus:


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 = eval(links(Data).outbound.example.$Name).format("","^linkTo(",")^;",""); 

The second step remains the same:

$FormattedList = $MySet.format("<ul>\n","\t<li>","</li>\n","</ul>\n"); 

A Tinderbox Reference File : Export : Exporting Set-type data