Tip>Designer

Dynamically create a List

 

Article #:

0012

Contributor:

Kate Kelly

GF version:

All

Applies to:

Lists

Last updated:

September 3, 2001

Description

At run time, create a List that does not get stored and is used only in one specific document.

Explanation

Instead of creating a List in the GhostFill List Editor and storing it so that it can be used in various templates, you may want to create an "ad-hoc" list that is used in only one specific template. The List tasks in the GhostFill Scripting Language allow you to dynamically create a List in a document.

 

Click here to view a step-by-step example.

To create a List at run time, insert the following tasks in your template:

  1. Create a reference to a new List:

e.g.,%[Names=Lists.New()]

  1. Add item/result pairs to the List using the ImportPairedList task:

e.g.,%[Names.ImportPairedList('/','Name1/John Smith/Name2/Alex Jones/Name3/Jennifer Simms')]

In the example above, the items and results in the List are defined by the delimiter specified ("/").

  1. Display the List so the user can select an item:

e.g.,%[^FullName=Names.SingleSelectList('Select a name',0)]

The example above displays the Names List as a drop-down list. The users selection can then be referenced using the FullName variable.

 

For further details of all the List tasks that are available, see the GhostFill Scripting Language Guide.