Collection variables are used to specify which category of data you would like to pull information from.
Accessing variables within a collection
The syntax for collection variables or loops always requires:
{#} the hashtag - opens a loop
{/} the forward slash - closes a loop
There are two ways to get information from a collection. In the example below we will use the example of the directors collection that contains the directors Jessica Day, Winston Schmidt, and Nicholas Miller.
1 |
|
Jessica Day |
2 |
|
Jessica Day, Winston Schmidt, Nicholas Miller, |
In example 1, we were able to access the director’s name using a _ to access the {name}
variable within the directors collection.
In example 2, we opened the collection with a # and used the single variable {name}
to access all of the directors names in the collection. We must also remember to close the collection with the closing tag {/}.
The location of the closing tag is very important and could cause errors if mishandled.
Loops
Example 2 above is an example of a loop. To begin looping through collections, we use the opening tag # before the collection name and use closing tags {/} when we want to end the loop.
Other ways to loop through collections is through a List or a Table.
Lists
Generated lists can be ordered or unordered. There are different ways to code lists.
-w:p
The -w:p
function is used to create bulleted lists without an additional line. Use -w:p
in the opening tag and remember to close the tag with {/}.
Example
You want to create a list of officers including their name and office.
|
|
You can use any type of bulleted or numbered list format offered by Microsoft Word.
You can also create a list using collection loops.
|
|
Make sure that the closing tag is not bulleted. If it is bulleted, you will be left with an empty bullet at the end of your list.