Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning

THIS PAGE IS UNDER CONSTRUCTION

Filtered loops can be used to find information pertaining to a contact with a particular affiliation type/role code.

Filtered Loop Syntax

Add a Where clause to the foreach loop to filter:

For example, to get the name of the owner:

Code Block
languagetext
<<foreach [contact in contacts.Where(x => x.affiliationTypeCode == “OWNR”)]>><<[contact.contactName]>><</foreach>>

If you want to protect against multiple matching contacts being returned (such as 2 or more owners in the example above), then add Take(1) to the markup:

Code Block
languagetext
<<foreach [contact in contacts.Where(x => x.affiliationTypeCode == “OWNR”).Take(1)]>><<[contact.contactName]>><</foreach>>

Finding Available Affiliation Types

Navigate to Admin > Lookups > Affiliation Types (Roles), this will display existing affiliation types. The Lookup Code is what is used to filter. 

Roles with one or more functional areas specified (e.g. Applicant, Permittee) can only be assigned in the designated area(s). Roles that don't have a functional area specified are available in all areas.

Tips and Tricks

  • A foreach syntax block can be inserted automatically into the template by double clicking a group name in the field selection list.


On this page

Table of Contents


Sub-Topics

Page Tree
root@self


Related Content