---
title: Formula startsWith – Check a Text Prefix in Nodinite Search Field Expressions
description: The startsWith function in the Nodinite Formula plugin returns true when the content starts with the expression. Syntax, parameters, and tested examples for message body, message context, and nested formulas.
---

# <i class="fal fa-function" aria-hidden="true"></i> Formula - startswith

The `startsWith` function, one of the Logical functions in the [Formula][] plugin for [Search Field Expressions][], returns `true` when the content starts with the expression (prefix).

![Uppercase a customer name with toUpperCase, then check an order id prefix with startsWith, animated walkthrough (7.12)][10]  
*Animated walkthrough: on the Order Received JSON of the [Order-to-Cash demo][], [toUpperCase][] of `jsonPath('$.customer.name', body)` returns `TAILSPIN TOYS`. `startsWith('ORD-', jsonPath('$.orderId', body))` returns `true` for `ORD-10005`. With the prefix `'INV-'` there is no match, and the Test tab shows *Processed with warning: The Expression yields no result*.*  

## <i class="fal fa-code" aria-hidden="true"></i> Syntax

```text
startsWith('expression', content [, content ...] [, matchAllValues])
```

### Parameters

| Parameter | Required | Description |
| --- | --- | --- |
| `'expression'` | ✅ Yes | The prefix to look for, in single quotes, for example `'G'`. It's case-sensitive: `startsWith('g', body)` on `GMT` gives no value. |
| `content` | ✅ Yes | The value or values to check: [body][Body], [context][Context], or another Formula function such as [regex][]. When you give several content arguments, each of them must match. |
| `matchAllValues` | ❌ No | Unquoted `true` or `false` (default). Applies when one content argument returns several values: `false` means at least one value must match, `true` means every value must match. A quoted `'true'` is not the flag; it is compared as text. |

### Returns

* `true` when the content starts with the expression.
* When it doesn't, there is no value: Test Expression shows *Processed with warning: The Expression yields no result*.
* When one content argument returns several values, one matching value is enough, unless `matchAllValues` is `true`.

Quoting, nesting, and how `content` is resolved are described in the [Formula language rules][].

## <i class="fal fa-list-ol" aria-hidden="true"></i> Examples

### Example 1: Check the message body

#### Input

Message Body:

```text
GMT
```

#### Formula

```text
startsWith('G', body)
```

#### Result

```text
true
```

![Test Expression with startsWith('G',body) on the message body GMT, returning true][11]  
*The message body `GMT` starts with `G`, so `startsWith` returns `true`.*  

### Example 2: Check a message context value

#### Input

Message Context:

| Key | Value |
| --- | --- |
| `id` | `GMT` |

#### Formula

```text
startsWith('G', context('id'))
```

#### Result

```text
true
```

![Test Expression with startsWith('G', context('id')) on the context key id with value GMT, returning true][13]  
*The context value of `id` is `GMT`, which starts with `G`, so `startsWith` returns `true`.*  

### Example 3: Check values extracted by another function

#### Input

Message Body:

```text
GMT UTC
```

#### Formula

```text
startsWith('U', regex('GMT|UTC', body))
```

#### Result

```text
true
```

![Test Expression with startsWith('U',regex('GMT|UTC',body)) on the message body GMT UTC, returning true][12]  
*[regex][] extracts `GMT` and `UTC`; `UTC` starts with `U`, and one match is enough, so `startsWith` returns `true`.*  

### Example 4: Check several message context values

#### Input

Message Context:

| Key | Value |
| --- | --- |
| `id` | `UMT` |
| `id1` | `UZZ` |

#### Formula

```text
startsWith('U', context(regex('id.*')))
```

#### Result

```text
true
```

![Test Expression with startsWith('U', context(regex('id.*'))) on the context keys id and id1, returning true][14]  
*`context(regex('id.*'))` returns the values of both keys, `UMT` and `UZZ`; they start with `U`, so `startsWith` returns `true`.*  

## <i class="fal fa-hand-point-right" aria-hidden="true"></i> Next Steps

* <i class="fal fa-magnifying-glass-plus" aria-hidden="true"></i> [Add or manage Search Field][]  
* <i class="fal fa-flask" aria-hidden="true"></i> [Test Your Expression][]  
* <i class="fal fa-hard-drive" aria-hidden="true"></i> [Add or manage Log View][]  

## <i class="fal fa-link-horizontal" aria-hidden="true"></i> Related Topics

* <i class="fal fa-equals" aria-hidden="true"></i> [equal][]  
* <i class="fal fa-not-equal" aria-hidden="true"></i> [notEqual][]  
* <i class="fal fa-circle-question" aria-hidden="true"></i> [isnull][]  
* <i class="fal fa-arrow-right-from-bracket" aria-hidden="true"></i> [endsWith][]  
* <i class="fal fa-function" aria-hidden="true"></i> [Formula][]  
* <i class="fal fa-scroll" aria-hidden="true"></i> [Formula language rules][]  
* <i class="fal fa-puzzle-piece" aria-hidden="true"></i> [Search Field Expressions][]  

[10]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Formula/Logical/Formula_UpperCaseStartsWith.gif
[11]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Formula/Logical/startswith_simplebody_.png
[12]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Formula/Logical/startswith_regexfunction.png
[13]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Formula/Logical/startswith_simplebody_messagecontext.png
[14]:https://docs.nodinite.com/media/Documentation%20Pictures/IM/WebClient/Admin/Log/Search%20Fields/Plugins/Formula/Logical/startswith_messagecontext_regex.png

[Add or manage Log View]:https://docs.nodinite.com/administration/log-management/log-views/features/add-or-manage-log-view/
[Add or manage Search Field]:https://docs.nodinite.com/administration/log-management/search-fields/features/add-or-manage-search-field/
[Body]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/source/body/
[Context]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/source/context/
[endsWith]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/logical/endswith/
[equal]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/logical/equal/
[Formula]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/overview/
[Formula language rules]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/overview/#fa-scroll-formula-language-rules
[isnull]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/logical/isnull/
[notEqual]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/logical/notequal/
[Order-to-Cash demo]:https://docs.nodinite.com/repository-model/bpms/examples/order-to-cash/generate-o2c-demo-data/
[regex]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/extract/regex/
[Search Field Expressions]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/overview/
[Test Your Expression]:https://docs.nodinite.com/administration/log-management/search-fields/features/add-or-manage-search-field/#test-your-expression
[toUpperCase]:https://docs.nodinite.com/administration/log-management/search-fields/features/search-field-expressions/formula/convert/touppercase/