> ## Documentation Index
> Fetch the complete documentation index at: https://docs.farmtrace.co.za/llms.txt
> Use this file to discover all available pages before exploring further.

# Text functions

> Join, inspect, split, clean, pad, and URL-encode client-facing text.

Text comparisons in this page are case-sensitive. Convert both sides with `Lower` or `Upper` first when case should not matter.

## `All`

Checks whether every item in a comma-separated list appears in another comma-separated value set.

* **Syntax:** `All(values, list)`
* **Requires:** two Text values containing comma-separated items. Items are trimmed before comparison.
* **Returns:** Boolean.
* **Best for:** confirming that every required tag, skill, or selection is present.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
All([Selected Tags], "Safety,Training")
```

## `Any`

Checks whether at least one item in a comma-separated list appears in another comma-separated value set.

* **Syntax:** `Any(values, list)`
* **Requires:** two Text values containing comma-separated items. Items are trimmed before comparison.
* **Returns:** Boolean.
* **Best for:** matching any accepted tag, role, or selection.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Any([Certifications], "Organic,GlobalGAP")
```

## `Begins`

Checks whether text starts with a given value.

* **Syntax:** `Begins(text, prefix)`
* **Requires:** two Text values.
* **Returns:** Boolean.
* **Best for:** prefixes, reference-number families, and route checks.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Begins([Batch Code], "ZA-")
```

## `Concat`

Joins two or more text values end to end.

* **Syntax:** `Concat(text, text[, text...])`
* **Requires:** at least two Text values. Convert other types with `ToText` or `Format` first.
* **Returns:** Text.
* **Best for:** labels, messages, identifiers, and printable descriptions.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Concat([First Name], " ", [Last Name])
```

## `Contains`

Checks whether text contains another text value.

* **Syntax:** `Contains(text, search)`
* **Requires:** two Text values.
* **Returns:** Boolean.
* **Best for:** notes, keywords, codes, and simple validation.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Contains(Lower([Notes]), "urgent")
```

## `Ends`

Checks whether text ends with a given value.

* **Syntax:** `Ends(text, suffix)`
* **Requires:** two Text values.
* **Returns:** Boolean.
* **Best for:** file suffixes, code endings, and domain checks.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Ends(Lower([Document Name]), ".pdf")
```

## `Guid`

Creates a new random uppercase identifier in GUID format.

* **Syntax:** `Guid()`
* **Requires:** no arguments.
* **Returns:** Text in `XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX` form.
* **Best for:** client-generated correlation IDs and temporary identifiers.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Guid()
```

Each call creates a new value. Store the result if later formulas must use the same identifier.

<Warning>
  `Guid()` provides a GUID-shaped pseudo-random value, not guaranteed global uniqueness. Do not use it for secrets, authentication, or authorization.
</Warning>

## `Left`

Returns characters from the left, or everything before the first delimiter.

* **Syntax:** `Left(text, count)` or `Left(text, delimiter)`
* **Requires:** Text plus a non-negative whole-number count or a Text delimiter.
* **Returns:** Text.
* **Best for:** prefixes and the first segment of a structured code.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Left([Batch Code], 3)
Left([Full Name], " ")
```

If a text delimiter is absent, the full source text is returned.

## `Len`

Returns the number of characters in text.

* **Syntax:** `Len(text)`
* **Requires:** a Text value.
* **Returns:** Numeric.
* **Best for:** length validation and padding decisions.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Len(Trim([Reference]))
```

## `List`

Joins supplied values with a delimiter while skipping `null` and empty text.

* **Syntax:** `List(delimiter, value[, value...])`
* **Requires:** a Text delimiter and one or more Text values.
* **Returns:** Text.
* **Best for:** readable address lines, names, and optional labels.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
List(", ", [Town], [Province], [Country])
```

Unlike `Concat`, `List` inserts the delimiter only between populated values.

## `Lower`

Converts text to lowercase using the active locale.

* **Syntax:** `Lower(text)`
* **Requires:** a Text value.
* **Returns:** Text.
* **Best for:** case-insensitive comparison and normalised export values.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Lower([Email])
```

## `Mid`

Returns a selected number of characters starting at a 1-based position.

* **Syntax:** `Mid(text, position, count)`
* **Requires:** Text, a position of at least `1`, and a non-negative whole-number count.
* **Returns:** Text.
* **Best for:** fixed-width identifiers and known text layouts.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Mid([Reference], 4, 6)
```

When the position is beyond the end of the source, the result is empty text.

## `NotLeft`

Removes characters from the left, or removes everything through the first delimiter.

* **Syntax:** `NotLeft(text, count)` or `NotLeft(text, delimiter)`
* **Requires:** Text plus a non-negative whole-number count or a Text delimiter.
* **Returns:** Text.
* **Best for:** removing prefixes and keeping the remainder after a separator.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
NotLeft("ZA-1042", "ZA-")
```

If a text delimiter is absent, the result is empty text.

## `NotRight`

Removes characters from the right, or removes the last delimiter and everything after it.

* **Syntax:** `NotRight(text, count)` or `NotRight(text, delimiter)`
* **Requires:** Text plus a non-negative whole-number count or a Text delimiter.
* **Returns:** Text.
* **Best for:** removing suffixes and keeping a path or code prefix.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
NotRight("report.final.pdf", ".")
```

If a text delimiter is absent, the result is empty text.

## `PadLeft`

Pads the left side until text reaches a requested total length.

* **Syntax:** `PadLeft(text, totalLength[, filler])`
* **Requires:** Text, a non-negative whole-number total length, and optional non-empty filler text. The default filler is a space.
* **Returns:** Text.
* **Best for:** fixed-width numbers and aligned export fields.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
PadLeft(ToText([Sequence]), 6, "0")
```

Text that is already long enough is returned unchanged.

## `PadRight`

Pads the right side until text reaches a requested total length.

* **Syntax:** `PadRight(text, totalLength[, filler])`
* **Requires:** Text, a non-negative whole-number total length, and optional non-empty filler text. The default filler is a space.
* **Returns:** Text.
* **Best for:** fixed-width labels and aligned export fields.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
PadRight([Code], 10, ".")
```

Text that is already long enough is returned unchanged.

## `Part`

Returns one segment from text split by any of the supplied delimiter characters.

* **Syntax:** `Part(text, index, delimiters)`
* **Requires:** Text, a non-zero whole-number index, and non-empty delimiter text. Positive indexes count from `1`; negative indexes count back from the end.
* **Returns:** Text, or empty text when the requested part does not exist.
* **Best for:** names, delimited codes, and selecting the last path segment.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Part("farm/field/row", 2, "/")
Part("farm/field/row", -1, "/")
```

Every character in `delimiters` acts as a separator. When a space is supplied alongside another delimiter, spaces next to that delimiter are ignored and a run of spaces is treated as one separator.

## `Proper`

Capitalises words while preserving words that are already all-uppercase as acronyms.

* **Syntax:** `Proper(text)`
* **Requires:** a Text value.
* **Returns:** Text.
* **Best for:** client names, places, and labels.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Proper("cape town QA team")
```

## `Replace`

Replaces every occurrence of one text value with another.

* **Syntax:** `Replace(text, oldText, newText)`
* **Requires:** three Text values.
* **Returns:** Text.
* **Best for:** cleanup, renaming, and simple template substitutions.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Replace([Phone], " ", "")
```

## `Right`

Returns characters from the right, or everything after the last delimiter.

* **Syntax:** `Right(text, count)` or `Right(text, delimiter)`
* **Requires:** Text plus a non-negative whole-number count or a Text delimiter.
* **Returns:** Text.
* **Best for:** suffixes, file extensions, and the final segment of a code.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Right([Reference], 4)
Right([Document Name], ".")
```

If a text delimiter is absent, the full source text is returned.

## `Trim`

Removes leading and trailing whitespace.

* **Syntax:** `Trim(text)`
* **Requires:** a Text value.
* **Returns:** Text.
* **Best for:** user-entered and imported values before validation.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Trim([Supplier Code])
```

## `Upper`

Converts text to uppercase using the active locale.

* **Syntax:** `Upper(text)`
* **Requires:** a Text value.
* **Returns:** Text.
* **Best for:** normalised codes, labels, and case-insensitive comparison.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Upper([Batch Code])
```

## `URLDecode`

Decodes percent-encoded UTF-8 URL text.

* **Syntax:** `URLDecode(text)`
* **Requires:** URL-encoded Text.
* **Returns:** decoded Text.
* **Best for:** query values and callback data received from an integration.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
URLDecode("Cape+Town%2C+ZA")
```

## `URLEncode`

Encodes text for use in a URL query value using UTF-8.

* **Syntax:** `URLEncode(text)`
* **Requires:** a Text value.
* **Returns:** URL-encoded Text.
* **Best for:** search links, callback URLs, and third-party requests.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
URLEncode([Customer Name])
```

## `URLParam`

Extracts and decodes a named parameter from a URL query string.

* **Syntax:** `URLParam(url, name[, index])`
* **Requires:** URL Text, parameter-name Text, and an optional 1-based whole-number occurrence index.
* **Returns:** Text, or `null` when the parameter or requested occurrence is absent.
* **Best for:** callback URLs and deep-link parameters.

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
URLParam([Callback URL], "record")
URLParam([Callback URL], "tag", 2)
```

Without an index, repeated values are returned as comma-separated text.

<Tip>
  Prefer `List` for optional display parts, `Concat` for exact joining, and the `&` operator for a short two-part join.
</Tip>
