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
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 nameisnull(context('customerId'), '0')β Provide default customer IDisnull(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
- How to Add or manage Search Fields
- How to Add or manage Log Views
Related Topics
- Body β Extract body from the Log Event
- Context β Extract context values from the Log Event
- jsonPath β Extract values from JSON using JSONPath expressions
- xpath β Extract values from XML using XPath expressions
- equal β Check if values are equal
- Expression Type Plugins are used in Search Fields
- What are Search Fields?
- What are Search Field Expressions?
- What are Message Types?
- What are Log Views?