FOREACH SLOT

The statement FOREACH SLOT enumerates all documents that are produced when running a Document Pack Template.

The following is a definition of the statement.

FOREACH SLOT Document IN DOCUMENTPACK
DO
  <Template scripting part with declarations>
OD

The loop variable Document is automatically declared and available in the DO ... OD loop. The name of the variable can be chosen but must match the rules for valid FIELDSET names. This loop variable behaves for all intents and purposes as a read-only FIELDSET variable. The contents can be copied to a regular FIELDSET variable.

If the FOREACH SLOT statement is used in a Template run as the Data Preparation Template or run outside the context of a Document Pack, the DO ... OD part is not executed. As an Data Preparation Template cannot produce a document, this Template is excluded from the enumeration.

The following fields are defined.

  • Type. The Type field indicates the type of the current slot. This field can have the following values:
    1. "Template". This slot contains a Document Template.
    2. "Import". This slot contains an Import Document.
  • Slot. This field contains the name of the slot as entered in the Document Pack Template Editor. If the slot is not assigned a name, this field remains empty.
  • Name. This field contains the slot identifier of the slot as entered in the Document Pack Template Editor.
  • Template. This field contains the full path of the Document Pack Template.
  • Description. This field contains the description of the slot in the Document Pack Template. If the slot is empty, the field contains the name of the Document Template.
  • Optional. This field indicates whether or not the slot is defined as optional in the Document Pack Template. If the slot is defined as optional, this field contains the value Y, otherwise N.
Optional slots must be selected by the user or application to appear in the FOREACH SLOT enumeration.
  • GUID. This field contains the GUID that identifies the slot.

The following is an example of the statement.

# BEGIN

  ...

#
Please find the following documents attached:
#
FOREACH SLOT Doc IN DOCUMENTPACK
DO
  IF Doc.Slot <> "Coverletter" THEN
#
- @(Doc.Description)
#
  FI
OD

END #

The result for this example Document Pack is as follows.

Please find the following documents attached:
- Policy
- Disclaimer
- Invoice