* feat: add first(), last() and generalized index() formula functions
* fix: address PR review feedback and handle NaN index argument
- Rename _BaserowIndexShortcut to BaserowIndexShortcut (drop leading _)
- Remove unnecessary comments and section separators
- Rename variable c to clone in JSONBArrayGetElement
- Rename test to test_first_and_last_return_scalar_values, drop docstring
- Remove step comments in test_index_generalized.py
- Handle NaN/div-by-zero as index() argument (returns null instead of crash)
* feat: update index() formula examples to include array fields
* feat: add array_slice() database formula function
* fix(formula): handle NaN arguments in array_slice to prevent DB crash
Wrap start/count args with handle_arg_being_nan before truncating to
int, so expressions like tonumber('x') no longer cause
"cannot convert NaN to integer" at the PostgreSQL level.
NaN is treated as 0 for both arguments.
* feat: add ARRAYUNIQUE() database formula function (#2326)
Add array_unique() formula that removes duplicate values from lookup
arrays, preserving first-occurrence order. Mirrors Airtable's
ARRAYUNIQUE() — operates on true arrays from lookup fields, not plain
text.
Supports text, number, boolean, date, duration, URL, email, phone,
rating, single select, multiple select, link row, created_on, and
autonumber sub-types. Rejects file fields (different JSONB structure).
* feat: enable count() and join() composability with array_unique()
Add internal non-aggregate functions (array_length, array_join_values)
that operate on JSONB arrays directly, and wire them into count() and
join() so that count(array_unique(...)) and join(array_unique(...), sep)
work. The existing many-expression paths remain unchanged.
* docs: add array_unique to formula docs, mark internals as exceptions
Add array_unique to formula_docs.md so the formula prompt completeness
tests pass. Add array_length and array_join_values (internal delegation
targets) to the formula_exceptions lists in both test files.
* chore: ensure tests works also for formulas referencing different field types