> For the complete documentation index, see [llms.txt](https://docs.atfinity.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.atfinity.io/rule-language/operators/list-operators/custom_max.md).

# CUSTOM\_MAX

### Description

`CUSTOM_MAX` returns the maximum element in a list as described by a second list. The second list gives the assigns a value to items in the first list in ascending order. If an element of the first list is not present in the second list, it is considered lower than all mentioned elements

### Example: Case colours

Given a list of case colours like `[red, green, green]` we would like to return the maximum as described by `[green, orange, red]`, where green means lowest value and red means highest value, so saying that red cases are most important:

```
CUSTOM_MAX([red, green, green, orange, green], [green, orange, red])
```

This will return `red`, as this is the maximum in the first list as described by the second list.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.atfinity.io/rule-language/operators/list-operators/custom_max.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
