- 3 minutes to read

Formula - isnull

New 6.1

Easily check for null or empty values and provide defaults using the Nodinite isnull Formula plugin. This page shows how to validate message Content, Context, or the output of other formulas, ensuring your integrations are robust and reliable.

🎯 Designed for business users and integrators β€” no developer required; you can even use AI to craft expressions.

  • βœ… Instantly detect null or empty values and set defaults from any Payload or Context in any Log Event
  • βœ… Fallback values to ensure data always has meaningful content
  • βœ… Transform and surface meaningful data in Nodinite Log Views, search filters, and self-service diagnostics
  • βœ… Combine with other Formula functions for powerful, layered expressions

What does the isnull Formula do?

The isnull('Expression', Content) Formula function checks if a value is null or contains only whitespace. If so, it returns a default value; otherwise, it returns the actual value. Use this function to ensure your data always has a meaningful value.


How it works: Input ➜ isnull ➜ Result

graph LR A["Input: Expression result"] --> B["isnull(expression, 'default')"] B --> C["Result: actual or default value"]

Flow: The expression is evaluated, and if null/empty, the default value is returned.


Examples

Below are practical examples showing how to provide default values for missing data.

Example 1: Provide Default When Value is Missing

Input

{ "name": "John Doe" }

Formula Expression

isnull(jsonPath('$.missingname', body()), 'Jane Doe')

Result

Jane Doe

Example 2: Return Actual Value When Present

Input

{ "name": "John Doe" }

Formula Expression

isnull(jsonPath('$.name', body()), 'Jane Doe')

Result

John Doe

Features

The isnull Formula function is highly flexible and can be nested with other formula functions. For instance, combine it with jsonPath, xpath, or context to provide fallbacks for missing data.

  • Check if the result from previous formula expressions yields empty data
  • Return either the actual value or a default value
  • Works with message body, Context, or results from other Formula functions
  • Ensures data integrity across integrated systems

Important

The isnull plugin loads the entire message into RAM. Only use this function on small messages to avoid performance issues.


How to use

The isnull formula provides fallback values for null or empty results. It's ideal for data validation, ensuring robustness, and handling missing fields gracefully.

Syntax

isnull(expression, 'DefaultValue')

Parameters:

  • expression: A formula expression that may return null or empty, e.g., jsonPath('$.field', body())
  • DefaultValue (string): The fallback value to use if expression is null or empty

Common patterns:

  • isnull(jsonPath('$.name', body()), 'Unknown') – Provide default name
  • isnull(context('customerId'), '0') – Provide default customer ID
  • isnull(xpath('/Id', body()), 'N/A') – Provide default ID

Use with different sources:

  • With jsonPath: isnull(jsonPath('$.field', body()), 'default')
  • With context: isnull(context('key'), 'default')
  • With xpath: isnull(xpath('/element', body()), 'default')

Next step