The HotDocs Computation Archive
Get Extra Help

0005 - Place a List in a Variable

Description:

Creates a list from the items in a repeated variable, and places the list in a single text variable so that it can be inserted anywhere in your document.


• Code •

""
REPEAT RepeatedDialog
   FORMAT "a, b and c"
   RESULT + "«Variable»"
END REPEAT

SET FormattedList-t TO RESULT
 
 
Alternative:

""
REPEAT RepeatedDialog
   FORMAT "a, b and c"
   RESULT + "«Variable»"
END REPEAT

• Explanation •

The computation runs a REPEAT dialog that contains the Variable you'll use as the source of your list. It formats the items into a list like this: "a, b and c". You can change that format. Finally, it drops the formatted list into the text variable FormattedList-t. You can place this variable anywhere in the document where you need the list. It won't matter whether it's inside another REPEAT. The Alternative code simply has the computation itself return the list value rather than setting it in another variable. But be warned that this method may produce an error if you place the computation inside of a REPEAT.