GS-Base Help > Using makeUnique() and isUnique() Functions

makeUnique(table, v, field)

Checks whether the value 'v' occurs in the 'field' in the specified 'table' and, if so, creates a copy of it by adding the (n) suffix for text strings, or adding 1 for numbers, until the unique value is found.

'v' can be any text, number or a text field name. The type of 'v' and the type of 'field' must be the same.

=makeUnique("products", "tofu", "productnames")    returns tofu(1)
=makeUnique("products", "tofu(1)", "productnames")    returns tofu(2)
=makeUnique("products", 10, "productID")    returns 78

isUnique(v)

Checks whether the value 'v' (a text string or a number) already occurs in the current field and, if so, returns 1. Otherwise it returns 0.

NOTE: The makeUnique() and isUnique() functions are two special functions that have the following restrictions:
If the 'table' is the same table where the function is used, makeUnique() can be executed only as a single-action field conversion or validation formula, and is inactive for any block operations or recalculation operations.
The isUnique() function is always used in-place, in the same field it refers to, and it can be executed only as a single-action field conversion or validation formula.