Tip>Designer

Iterating over a collection

 

Article #:

0023

Contributor:

Daniel Todes

GF version:

All

Applies to:

Collections

Last updated:

November 15, 2001

Description

Iterate over a collection using the GhostFill Document Logic tasks.

Explanation

The GhostFill Document Logic tasks allow you to iterate over a collection and access the data in your collection from FillPoints.

 

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

Assume you have a main Dialog called "Mortgage", and off Mortgage you have a sub-Dialog collection called "Party". Assume that inside Party there are two fields called "Name" and "IDNumber".

  1. Method 1 using the ForEachBlock task:

%[ForEachBlock("x",Mortgage.Party)]

The value of Name is: %[x.Name]

The value of ID Number is: %[x.IDNumber]

%[EndBlock()]

  1. Method 2 using the RepeatBlockWhile task:

%[i=1]%[RepeatBlockWhile(i<=Mortgage.Party.Count)]

The value of Field1 is: %[Mortgage.Party[i].Field1]

The value of Field2 is: %[Mortgage.Party[i].Field2]

%[i=i+1]%[EndBlock()]

 

NOTE

For more information on the Document Logic tasks see the GhostFill Technical Reference Guide.