Skip to main content
All CollectionsLender Expression Engine
Working with Arrays in the Lender Expression Engine
Working with Arrays in the Lender Expression Engine
Updated over 5 months ago

Introduction:

The Lender Expression Engine supports the use of arrays, enabling users to perform complex operations on collections of data within the Lender platform. This article provides an overview of how to work with arrays in the Lender Expression Engine, including common functions and examples.

Understanding Arrays:

Arrays in the Lender Expression Engine are defined with a specific entity type. For instance, the property Application.Borrowers might have the type array<ApplicationBorrower>. Arrays allow you to store and manipulate multiple items of the same type, making it easier to perform batch operations and evaluations.

Common Array Functions:

The Lender Expression Engine provides several functions to operate on arrays. Here are some of the most commonly used functions:

1. ALL(array, innerExpression):

  • Description: Returns true if all elements in the array match the inner expression.

  • Example: ALL(Application.Borrowers, AND(_borrower.Person.Disclosures.UsCitizen == true, _borrower.SpousePerson.Disclosures.UsCitizen == true))

2. ANY(array, innerExpression):

  • Description: Returns true if at least one element in the array matches the inner expression.

  • Example: ANY(Application.Borrowers, _borrower.Person.FirstName == 'John')

3. COUNT(array):

  • Description: Returns the count of elements in the array.

  • Example: COUNT(Application.Borrowers) == 1

4. SUM(array, value):

  • Description: Returns the sum of the specified numeric values in the array.

  • Example: SUM(Application.Borrowers, _borrower.Person.Incomes, _income.MonthlyIncome) > 10000

Using Array Functions:

Example 1: Checking All Elements in an Array

AND( ALL(Application.Borrowers, _borrower.Person.Disclosures.UsCitizen == true), COUNT(Application.Borrowers) > 1 )

This example checks if all borrowers in the application are U.S. citizens and ensures that there is more than one borrower.

Example 2: Summing Values in an Array

SUM(Application.Borrowers, _borrower.Person.Incomes, _income.MonthlyIncome) > 10000

This example calculates the total monthly income of all borrowers and checks if it exceeds $10,000.

Combining Array Functions:

You can combine multiple array functions to create more complex expressions. For example, you might want to ensure that at least one borrower has a specific attribute while also verifying the total count of borrowers.

Example3 : Combined Array Functions

AND( ANY(Application.Borrowers, _borrower.Person.FirstName == 'John'), COUNT(Application.Borrowers) == 2 )

This example checks if there is at least one borrower named John and ensures there are exactly two borrowers in the application.

Conclusion:

Arrays in the Lender Expression Engine offer powerful capabilities for working with collections of data. By using functions like ALL, ANY, COUNT, and SUM, users can create sophisticated expressions to evaluate and manipulate array data effectively. These functions enable the creation of dynamic and flexible workflows tailored to specific business needs.

Did this answer your question?