Tinderbox 7 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:

format($MySet"

\n"); 

This gives:

  • cow
  • dog
  • eel

More convenient my be to use .format():

$MySet.format("

\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"); 

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"); 



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