- 3 minutes to read

Formula - startswith

Easily determine if your data starts with a specific value using the Nodinite startswith Formula plugin. This page shows how to validate message Content, Context, or the output of other formulas, ensuring your integrations are accurate and reliable.

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

  • βœ… Quickly check if text starts with a given value from any Payload or Context in any Log Event
  • βœ… Boolean result (true/false) for conditional logic and filtering
  • βœ… 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 startswith Formula do?

The startswith formula checks if a text value (string) begins with a specific letter, word, or pattern. If the value matches at the start, the result is true; otherwise, the result is empty. Use this function to filter or validate data in your log views and search fields.


How it works: Input ➜ startswith ➜ Result

graph LR A["Input: Text string"] --> B["startswith('prefix', Content)"] B --> C["Result: true or false"]

Flow: The text is checked to see if it starts with the specified value, returning a boolean result.


Examples

Below are practical examples showing how to check if text starts with a specific value.

Example 1: Message Body as Content

Input

GMT

Formula Expression

startswith('G', body())

Result

true

startswith

The result is true because the message body starts with 'G'


Example 2: Message Context as Content

Input

GMT

Formula Expression

startswith('G', context('id'))

Result

true

Simple startswith_MessageContext

The result is true because the context value for 'id' starts with 'G'


Example 3: Nested Formula as Content

Input

GMT UTC

Formula Expression

startswith('U', regex('GMT|UTC', body()))

Result

true

startswith_Regex

The result is true because the regex function extracts 'UTC', which starts with 'U'


Features

The startswith Formula function is highly flexible and can be nested with other formula functions. For instance, combine it with regex, jsonPath, or substring to validate extracted or transformed data.

  • Check if text starts with a specific value (case-sensitive)
  • Returns boolean true or false for conditional logic
  • Works with message body, Context, or results from other Formula functions
  • Ideal for filtering and validating integration data

Important

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


How to use

The startswith formula validates if text starts with a specified string. It's ideal for prefix validation, file name checks, or conditional filtering.

Syntax

startswith('value', Content)

Parameters:

  • value (string): The prefix string to check for, e.g., 'G', 'http', '#'
  • Content (string): The text content to validate, typically from body() or context()

Common patterns:

  • startswith('G', body()) – Check if body starts with "G"
  • startswith('http', context('url')) – Validate URL protocol
  • startswith('#', context('comment')) – Check comment marker

Use with different sources:

  • Check message body: startswith('prefix', body())
  • Check message context: startswith('value', context('MessageContextKey'))
  • Check formula result: startswith('U', regex('GMT|UTC', body()))

Next step