Home / Blog / Everything You Need To Know About Lambdas

Everything You Need To Know About Lambdas


We first introduced the concept of DriveWorks Lambda functions in DriveWorks 21. But what are lambdas, and how do you use them in DriveWorks?

In this blog, we’ll explore how lambda functions work, when to use them, and how to get started with your own DriveWorks Lambdas.


What is a lambda?

Lambda functions are a technique that was developed in the programming world. They were invented by Alonzo Church in the 1930s as a system for investigating the foundations of mathematics, specifically focusing on functions and their application. They are also known as “Anonymous Functions”.

In DriveWorks, lambdas are a way to create custom functions to make your rules easier to read and understand without doing any coding.


Why should I use lambdas?

Lambdas are designed to make your rules more readable, more understandable, and more reusable. Lambda functions are designed to make things easier and are a natural extension of DriveWorks Rules.

The primary goal of a lambda function should be to reduce the complexity and length of your rules by taking sections of those rules and making them reusable building blocks. Those blocks are your lambdas.

DriveWorks Lambdas, “DWLambda“, effectively add your own functions to a DriveWorks Project and can be used to:

  • Create commonly used formula
  • Eliminate the need to recreate the same formula in many places
  • Create complex formula
  • Embed existing functions within the formula
  • Create your lambda function in a variable

Look for lambda uses

If you’re new to lambdas, take some time to identify where you could use them. Here are our suggestions on how to find scenarios where a lambda could make your rules much easier to use, read, and share:

  • Look for repeated bits of rules
  • Look for duplicated variables
  • Look for rules that are long or complicated
  • Look for places where you are using Indirect or MyName or MyNumber

Getting started with lambdas

Once you’ve identified areas where you’re going to use lambdas, getting started is easy. If you know how to write rules in Excel or DriveWorks, then following the lambda syntax below, you can start to write your lambdas!

Lambda syntax

Writing your lambda

Start by creating your rule using the DriveWorks Rules Builder tools. Then turn it into a lambda function by following these steps:

  1. Add DWLambda( to the front
  2. Add the closing ) to the end
  3. Add in your inputs
  4. Replace your inputs in the rule
  5. Test with Direct Invocation
  6. Remove the Direct Invocation
  7. Close the DriveWorks Rules Builder
  8. Create a test variable

Lambda tips

– Your Lambda should describe what it returns or what it does

– Your inputs should describe what they are and their requirements/limits

– Function Help displays name and inputs for Lambda functions

Think about your audience, for example, other DriveWorks administrators in your company

Be consistent


How can I learn more about lambdas?

We have several courses in the DriveWorks Learning Portal where you can learn more about lambdas, together with a DWLambda Tech Tip, lambda threads in the DriveWorks Forum, and the DriveWorks Help File.

DriveWorks 21 Feature Focus

Our experts look at the new lambda technology added in DriveWorks 21. With example use cases for lambda functions and tips for implementing them in your own DriveWorks Projects.

Final Ascent – Lambda Functions

Starting with a basic explanation of what lambda functions are, before diving into how to use them with a variety of examples.

How we’ve been using the new DWLambda functionality

A DriveWorks World 2024 live session recording where DriveWorks technical experts share how we are using DWLambda functionality.